Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How to implement closures in Package

by tfrayner (Curate)
on Mar 13, 2007 at 11:03 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found