YAPC::NA 2011 • Asheville, NC

Practical AnyEvent
By Stephen Scaffidi (‎hercynium‎) from Boston.pm, drinkers.pm
Date: Tuesday, 28 June 2011 13:50
Duration: 80 minutes
Target audience: Advanced
Tags: anyevent asynchronous event

Update: I have started a github repo with the code examples from the talk here: https://github.com/Hercynium/anyevent-examples. I hope to add more over time and would love to get more from anybody who wants to add anything!

Asynchronous programming is oft considered a black art, and in many ways it is. In any event (pun intended!), as is usually the case with Perl, there are many ways to do it.

Why choose one toolkit or framework over another? That's part of the challenge. Event-based programming doesn't have to be hard or even painful, and it's not... once you've wrapped your head around it and understand what's going on. In my opinion, one of the main factors in your choice should be your comfort level with the fundamentals of the framework you choose.

This talk is intended to be a tutorial for those who want to get up-end-running with AnyEvent, beyond the trivial examples and code-snippets available in the documentation and other tutorials out on the web. First, we'll cover the core ideas behind its design and API, and then we'll step through how one goes about writing a simple, fully-asynchronous application. As we go along, I'll point out some good practices, techniques, and how to avoid the pitfalls and subtleties that can lead to frustration and confusion.

Please be aware that in order to understand the content of this talk you will need to have a firm grasp on closures, lexical scope, and basic perl OO.

Attended by: