NAME
POE::Watcher::Delay - wait for a length of time to pass
SYNOPSIS
# Note, this is not a complete program.
# See the distribution's examples directory.
# Request a delay notification.
$self->{req}{watcher} = POE::Watcher::Delay->new(
seconds => 10, # wait 10 seconds, then
on_success => "time_is_up", # call $self->time_is_up()
args => {
param_1 => 123, # with $args->{param_1}
param_2 => "abc", # and $args->{param_2}
},
);
# Handle the delay notification.
sub time_is_up {
my ($self, $args) = @_;
print "$args->{param_1}\n"; # 123
print "$args->{param_2}\n"; # abc
delete $self->{req}{watcher}; # Destroy the watcher.
}
DESCRIPTION
A POE::Watcher::Delay object waits a certain amount of time before invoking a method on the current Stage object. Both the time to wait and the method to invoke are given as constructor parameters. Additional parameters are passed unchanged to the desired callback method after the specified time has elapsed.
PUBLIC METHODS
These methods are invoked directly on the watcher object.
new seconds => SECONDS, on_success => METHOD_NAME
Construct a new POE::Watcher::Delay object. The constructor takes two parameters: "seconds" is the number of seconds to wait. "on_success" is the name of the mothod in the current Stage to invoke when length seconds have elapsed.
Destroy this object to cancel it.
BUGS
See http://thirdlobe.com/projects/poe-stage/report/1 for known issues. See http://thirdlobe.com/projects/poe-stage/newticket to report one.
SEE ALSO
POE::Watcher describes concepts that are common to all POE::Watcher classes. It's required reading if you want to fully understand what's going on.
AUTHORS
Rocco Caputo <rcaputo@cpan.org>.
LICENSE
POE::Watcher::Delay is Copyright 2005 by Rocco Caputo. All rights are reserved. You may use, modify, and/or distribute this module under the same terms as Perl itself.