POE - the Perl Operating Environment
use POE;
In general, POE provides "kernel" services, including select(2), events signals, alarms and reusable boilerplates for common functions.
select(2)
In specific, POE uses POE::Kernel and POE::Session for you.
POE::Kernel
POE::Session
POE::Kernel - main loop; select(2), signal, alarm, event services
POE::Session - state machine managed by POE::Kernel
POE::Driver (abstract) - drive (read and write) an IO::Handle
IO::Handle
POE::Driver::SysRW - sysread and syswrite on an IO::Handle
sysread
syswrite
POE::Filter (abstract) - bidirectional stream cooker; converts raw data to something useful (such as lines), and back
POE::Filter::Line - break input into lines; add newlines to output
POE::Wheel (abstract) - a way to extend POE::Session by adding or removing event handlers from state machines
POE::Wheel::ReadWrite - manage read/write states for a session
POE::Wheel::ListenAccept - accept incoming TCP socket connections
POE::Wheel::FollowTail - watch the end of an ever-growing file
tests/followtail.perl
Starts 21 sessions, and runs them until SIGINT. 10 sessions write to dummy log files; 10 sessions follow the log tails; one session spins its wheels to make sure things are not blocking.
tests/forkbomb.perl
Starts one session whose job is to continually start copies of itself (and occasionally quit). A counter limits this test to about 150 total sessions, and the kernel will respond to SIGINT by killing everything and exiting.
This is an excellent shakedown of parent/child relationships and signals.
tests/objsessions.perl
This is a version of tests/sessions.perl (see below) that uses a blessed object's methods as event handlers. Thanks to sky_GOD for the idea and original code.
tests/proxy.perl
This is a simple line-based TCP proxy. It redirects connections from localhost:7777 to perl.com:echo. It shows how to use two or more wheels from a single session.
tests/selects.perl
Starts two sessions, and runs until SIGINT. The first session is a TCP chargen server; the second is a simple TCP client that connects to the first. The client session has a limiter that causes the session to exit after printing a few chargen lines.
POE::Wheel::ReadWrite and POE::Wheel::ListenAccept were based on the code here.
POE::Wheel::ReadWrite
POE::Wheel::ListenAccept
This was the second test, written to exercise the select(2) logic in POE::Kernel.
tests/sessions.perl
Starts five sessions that loop a few times and stop. It was written to exercise the POE::Kernel event queue.
tests/signals.perl
One session that prints out a dot every second and recognizes SIGINT.
tests/curator.perl
Lame attempt to exercise POE::Curator.
POE::Curator
None known.
Copyright 1998 Rocco Caputo <troc@netrus.net>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install POE, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE
CPAN shell
perl -MCPAN -e shell install POE
For more information on module installation, please visit the detailed CPAN module installation guide.