Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 rifling through the Monastery: (8)
As of 2015-07-30 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls