POE: Perl Object Environment. 15 Minute Lightning (and thunder) talk - Steve McNabb Toronto Perl Mongers - 30 Aug 2001 steve@justsomeguy.com -- What is POE? From the offical POE homepage at http://poe.perl.org, * "POE is a framework for event driven state machines." * it was written by Rocco Caputo. * originally written to manage a MUD * provides a set of tools for managing multiple state machines. * POE is 3 years old - nice and stable * effectively provides cooperative multitasking in perl * won "best new module" award at TPC 3.0 -- A What Machine? What is a state machine? * sometimes called 'finite state automata' * consist of states and transitions * state: things like "waiting for bus", "paying fare", "chatting with the person next to me on the bus" * transition: "done waiting for the bus. now go up and pay the fare" or "stop chatting with person next to me, start staring out the window" Ascii Fu:
........... ...........
| State 1 | -=> transition to state 2 -=> | State 2 |
........... ...........
^ |
| |
|- transition back to state 1 |- transition to state 3
| V
........... ............
| State 4 | <=- transition to state 4 <=-| State 3 |
........... ............
--
An Example:
A simple example would be something like a door. The door
only really has three possible 'states':
* open
* closed
* partially open (or partially closed if you're a pessimist)
and there would be a transition from each state to each other
relevant state.
* door is closed. begin opening
* door is partially open, continue opening
* door is still partially open, continue closing
* door is open, begin closing
* do nothing - leave the door alone
--
The plot thickens:
POE does cooperative multitasking - in pure perl. This means
that each 'Session' (loosely analagous to an operating system
process) must cooperate, and offer control of the CPU to other sessions
as long as its around. This means (ideally) everyone plays nicely,
and no one session hogs the CPU.
This also means you can have lots of individual sessions clicking along
and the POE kernel will divide up the available CPU resources among
each session, and make sure each session gets its piece of the
processing pie.
--
Think of it like a mini operating system - in perl.
That's what your operating system does: it handles requests for
resources from multiple processes at once, and (hopefully)
keep processes from colliding with one another.
* POE is very featureful.
POE has
Sample Output (in case we don't have POE on the display machine) Questions? --