Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Trying to Understand Callback(s)

by ikegami (Patriarch)
on Nov 23, 2017 at 22:53 UTC ( [id://1204174]=note: print w/replies, xml ) Need Help??


in reply to Trying to Understand Callback(s)

\&get_callback doesn't call get_callback; it returns a reference to it. This reference will be used by get to invoke the sub at a later time (e.g. when the request succeeds or fails). When get invokes it, it will pass parameters to it.

sub get { my ($ua, $url, $cb) = @_; ... $cb->($foo, $tx); # Call the referenced sub. ... }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2025-07-20 10:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.