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

Re^3: Why callbacks?

by pileofrogs (Priest)
on Mar 30, 2007 at 17:43 UTC ( [id://607548]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Why callbacks?
in thread Why callbacks?

++!

Okay, that makes sense! Events. Ah...

And it suddenly reminds me of where I've seen callbacks that didn't annoy me: signal handlers.

Would I be going out on a limb if I said the use of callbacks in Net::IMAP is a little .. er.. funny?

For those of you who haven't had the (dis)pleasure of working with that particular module, if you want to know the size of an email message, you send a query to the IMAP server and get the results via callback.

Replies are listed 'Best First'.
Re^4: Why callbacks?
by Jenda (Abbot) on Mar 30, 2007 at 19:43 UTC

    It does. Maybe I'm missing something but just now it seems that the author is using callbacks for no good reason.

    Whats even worse is that the module was released 03 Oct 1999, its tests (or instalation) fails in 8 of 10 CPAN Testers' attempts and the request tracker contains unapplied patches as old as Mar 12 2002. There are actually four bugs in RT, all in state "new". Looks like an abandoned module to me.

    Maybe you'd have more luck with Net::IMAP::Simple or IMAP::Client. I've never used either of those, but they seem to be in a better shape. They pass their tests, have less reported bugs and the bugs are not as old. (The Net::IMAP::Simple is NOT based on Net::IMAP!)

Re^4: Why callbacks?
by perrin (Chancellor) on Mar 30, 2007 at 19:43 UTC
    I think you're right -- using callbacks for that sounds like a very strange API choice. I assume it does this because the set of data to be fetched could be very large and take a while. Most perl programmers are more accustomed to an OO iterator API in that situation, like what DBI provides.
Re^4: Why callbacks?
by f00li5h (Chaplain) on Mar 31, 2007 at 01:33 UTC

    Since IMAP commands are asynchronous it would make sense for them to be handled with callbacks.

    I can request the headers for one message, and then request the body for the other, without getting the answer for the first one back, and it can give me the answer to any pending IMAP query in any order it likes.

    @_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-29 13:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found