The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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.
        my $watcher :Req = 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
                my $watcher :Req = undef;     # 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. Parameters included in the args hash 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.

Like every other watcher object, this one must be saved in order to remain active. 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.

POE::Stage is too young for production use. For example, its syntax is still changing. You probably know what you don't like, or what you need that isn't included, so consider fixing or adding that, or at least discussing it with the people on POE's mailing list or IRC channel. Your feedback and contributions will bring POE::Stage closer to usability. We appreciate it.

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-2006 by Rocco Caputo. All rights are reserved. You may use, modify, and/or distribute this module under the same terms as Perl itself.