Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Thanx, it's clear now.
I was just surprised that you need two decorators! I thought you could simply do something like test(def _(x): print("You are in block %s" % x)) (like test sub { print("You are in block $_[0]") } in Perl) Just to get closer to the Ruby feeling and to achieve this
But one needs decorators to manipulate a literal function. Obviously, there is only this way to do it. FWIW Python decorators could quite easily be simulated in Perl with attributes. I will post this soon (if I can't find it already on CPAN) =)
Cheers Rolf ( addicted to the Perl Programming Language) In reply to Re^8: RFC: Simulating Ruby's "yield" and "blocks" in Perl (Python)
by LanX
|
|