2010/03/31

Perl - IO::Async

IO::Async is:
  • a Perl module distribution
  • a generic eventing framework
  • suitable for all kinds of IO-bound tasks
  • a way to achieve IO concurrency
  • portable to Linux, Solaris, BSDs, other POSIXes
  • mostly-working on cygwin
  • able to use OS-specific optimisations where appropriate
  • able to use Glib for running GTK2-based GUI applications
IO::Async serves as a base layer for all kinds of IO-heavy programs.

Its design is centred around passing code references as continuations; handlers to invoke when a certain event happens, or after a certain operation has completed. By relying on lexical variable capture in these code references, these continuations can easily store state in normal variables.

It's a different approach than that taken by POE, the other eventing system for Perl, but I find this approach fits better in my head. If you dislike storing state in a hash to pass it around disjoint named functions loosely connected by event names, you might just want to give it a try...