Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Functional Programming & method rewriting

by SpanishInquisition (Pilgrim)
on Oct 28, 2004 at 22:36 UTC ( [id://403538]=note: print w/replies, xml ) Need Help??


in reply to Re: Functional Programming & method rewriting
in thread Functional Programming & method rewriting

Yep, good explanation. To add some further confusion (or perhaps to explain the shift trick), if I change around the last few lines and the functions will actually take arguments ...

my $hi_mom = prefix_later( sub { my $f = shift(); print "got: $f\n"; }, sub { print "this was unneccessary:\n"; } ); $hi_mom->("nerp") for (1..3);

Output:

got: nerp this was unneccessary: got: nerp this was unneccessary: got: nerp

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-17 05:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found