This class creates an event that will trigger a callback after all other pending events have been triggered.
$plain_event = Stem::Event::Plain->new( 'object' => $self ) ;
This class creates an event that will trigger a callback whenever its its signal has been received.
$signal_event = Stem::Event::Signal->new( 'object' => $self, 'signal' => 'INT' ) ; sub sig_int_handler { die "SIGINT\n" }
This class creates an event that will trigger a callback after a time period has elapsed. The initial timer delay is set from the 'delay', 'at' or 'interval' attributes in that order. If the 'interval' attribute is not set, the timer will cancel itself after its first triggering (it is a one-shot). The 'hard' attribute means that the next interval delay starts before the callback to the object is made. If a soft timer is selected (hard is 0), the delay starts after the callback returns. So the hard timer ignores the time taken by the callback and so it is a more accurate timer. The accuracy a soft timer is affected by how much time the callback takes.
$timer_event = Stem::Event::Timer->new( 'object' => $self, 'delay' => 5, 'interval' => 10 ) ; sub timed_out { print "timer alert\n" } ;
This class creates an event that will trigger a callback whenever its file descriptor has data to be read. It takes an optional timeout value which will trigger a callback to the object if no data has been read during that period.
Read events are active when created - a call to the stop method is needed to deactivate them.
This class creates an event that will trigger a callback whenever its file descriptor can be written to. It takes an optional timeout value which will trigger a callback to the object if no data has been written during that period.
Write events are stopped when created - a call to the start method is needed to activate them.
To install Stem, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Stem
CPAN shell
perl -MCPAN -e shell install Stem
For more information on module installation, please visit the detailed CPAN module installation guide.