Uri Guttman > Stem-0.11 > Stem::Event

Download:
Stem-0.11.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  5
Open  0
View/Report Bugs
Source   Latest Release: Stem-0.12

Stem::Event::Plain::new

This class creates an event that will trigger a callback after all other pending events have been triggered.

Example

        $plain_event = Stem::Event::Plain->new( 'object' => $self ) ;

Stem::Event::Signal::new

This class creates an event that will trigger a callback whenever its its signal has been received.

Example

        $signal_event = Stem::Event::Signal->new( 'object' => $self,
                                                  'signal' => 'INT' ) ;

        sub sig_int_handler { die "SIGINT\n" }

Stem::Event::Timer::new

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.

Example

        $timer_event = Stem::Event::Timer->new( 'object' => $self,
                                                'delay'  => 5,
                                                'interval'  => 10 ) ;

        sub timed_out { print "timer alert\n" } ;

Stem::Event::Read::new

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.

Stem::Event::Write::new

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.

syntax highlighting: