GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  POE::COMPONENT::SCHEDULE (3)

.ds Aq ’

NAME

POE::Component::Schedule - Schedule POE events using DateTime::Set iterators

CONTENTS

SYNOPSIS



    use POE qw(Component::Schedule);
    use DateTime::Set;

    POE::Session->create(
        inline_states => {
            _start => sub {
                $_[HEAP]{sched} = POE::Component::Schedule->add(
                    $_[SESSION], Tick => DateTime::Set->from_recurrence(
                        after      => DateTime->now,
                        before     => DateTime->now->add(seconds => 3),
                        recurrence => sub {
                            return $_[0]->truncate( to => second )->add( seconds => 1 )
                        },
                    ),
                );
            },
            Tick => sub {
                print tick , scalar localtime, "\n";
            },
            remove_sched => sub {
                # Three ways to remove a schedule
                # The first one is only for API compatibility with POE::Component::Cron
                $_[HEAP]{sched}->delete;
                $_[HEAP]{sched} = undef;
                delete $_[HEAP]{sched};
            },
            _stop => sub {
                print "_stop\n";
            },
        },
    );

    POE::Kernel->run();



DESCRIPTION

This component encapsulates a session that sends events to client sessions on a schedule as defined by a DateTime::Set iterator.

POE::Component::Schedule METHODS

spawn(Alias => name)

Start up the PoCo::Schedule background session with the given alias. Returns the back-end session handle.

No need to call this in normal use, add() and new() all crank one of these up if it is needed.

add(CI$session, CI$event_name, CI$iterator, CI@event_args)



    my $sched = POE::Component::Schedule->add(
        $session,
        $event_name,
        $DateTime_Set_iterator,
        @event_args
    );



Add a set of events to the scheduler.

Returns a schedule handle. The event is automatically deleted when the handle is not referenced anymore.

new(CI$session, CI$event_name, CI$iterator, CI@event_args)

new() is an alias for add().

SCHEDULE HANDLE METHODS

delete()

Removes a schedule using the handle returned from add() or new().

<B>DEPRECATEDB>: Schedules are now automatically deleted when they are not referenced anymore. So just setting the container variable to undef will delete the schedule.

SEE ALSO

POE, DateTime::Set, POE::Component::Cron.

SUPPORT

You can look for information at:
o RT: CPAN’s request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-Schedule>: post bug report there.

o CPAN Ratings

<http://cpanratings.perl.org/p/POE-Component-Schedule>: if you use this distibution, please add comments on your experience for other users.

o Search CPAN

<http://search.cpan.org/dist/POE-Component-Schedule/>

o AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/POE-Component-Schedule>

ACKNOWLEDGMENT & HISTORY

This module was a friendly fork of POE::Component::Cron to extract the generic parts and isolate the Cron specific code in order to reduce dependencies on other CPAN modules.

See <https://rt.cpan.org/Ticket/Display.html?id=44442>.

The orignal author of POE::Component::Cron is Chris Fedde.

POE::Component::Cron is now implemented as a class that inherits from POE::Component::Schedule.

Most of the POE::Component::Schedule internals have since been rewritten in 0.91_01 and we have now a complete test suite.

AUTHORS

Olivier Mengue\k:'dolmen@cpan.org
Chris Fedde, cfedde@cpan.org

COPYRIGHT AND LICENSE

Copyright X 2009-2010 Olivier Mengue\k:'\h |\n:u.
Copyright X 2007-2008 Chris Fedde.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 POE::COMPONENT::SCHEDULE (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.