http://qs321.pair.com?node_id=607530

pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:

In Net::IMAP and others, a module will pass you data by requiring that you pass a subroutine reference that the module will execute when the time comes to pass back the data.

Then I have to use uncomfortable globals to get the data out of that sub and it's harder to debug because I don't know what's calling my sub and what my sub returns.

Am I missing the beauty of callbacks? What are they for? Why would someone use them instead of just returning a hash ref or something like that?