Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How to implement closures in Package

by tfrayner (Curate)
on Mar 13, 2007 at 11:03 UTC ( #604504=note: print w/ replies, xml ) Need Help??


in reply to How to implement closures in Package

Hi,

You're just missing the assignment to $self in greet():

sub greet { my($self, $grt) = @_; return sub { my($subject)= @_; print "$grt $subject \n"; }; }
This should then work as you expect.

Cheers,

Tim


Comment on Re: How to implement closures in Package
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://604504]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2014-07-26 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls