Timer/alarm clock module

Discussion in 'Perl Misc' started by Ignoramus27279, Jul 29, 2005.

  1. Is there some perl module for setting alarms? The use I have in mind
    is as follows:

    my $times = new AlarmModule( 600, sub { print "Hello" } );

    that would make the timer wake up every 600 seconds and print hello.

    Any suggestions?

    i
     
    Ignoramus27279, Jul 29, 2005
    #1
    1. Advertising

  2. Ignoramus27279

    Perl Learner Guest

    1. Advertising

  3. On Fri, 29 Jul 2005 19:06:09 -0000, HaroldWho <> wrote:
    > On Fri, 29 Jul 2005 18:53:21 GMT, Ignoramus27279 wrote in comp.lang.perl.misc:
    >> Is there some perl module for setting alarms? The use I have in mind
    >> is as follows:
    >>
    >> my $times = new AlarmModule( 600, sub { print "Hello" } );
    >>
    >> that would make the timer wake up every 600 seconds and print hello.
    >>
    >> Any suggestions?

    >
    > See the Time::HiRes module pod.
    >


    Thanks, I was looking for something object oriented that hides
    $SIG{ALRM} and such.

    i
     
    Ignoramus27279, Jul 29, 2005
    #3
  4. Also sprach Ignoramus27279:

    > Is there some perl module for setting alarms? The use I have in mind
    > is as follows:
    >
    > my $times = new AlarmModule( 600, sub { print "Hello" } );
    >
    > that would make the timer wake up every 600 seconds and print hello.
    >
    > Any suggestions?


    You could use Event::Lib although it might be a bit oversized for that
    kind of task:

    use Event::Lib;

    $| = 1;

    my $timer = timer_new(
    sub {
    my $event = shift;
    print "Hello";
    $event->add(600); # re-schedule
    }
    );
    $timer->add(600);
    $timer->dispatch;

    Tassilo
    --
    use bigint;
    $n=71423350343770280161397026330337371139054411854220053437565440;
    $m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
     
    Tassilo v. Parseval, Jul 30, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    1,282
    Eric Smith
    Dec 2, 2007
  2. naqiboy

    simple vhdl alarm clock

    naqiboy, May 2, 2008, in forum: VHDL
    Replies:
    0
    Views:
    1,832
    naqiboy
    May 2, 2008
  3. Alexnb
    Replies:
    0
    Views:
    270
    Alexnb
    Jun 13, 2008
  4. Rajiv Abraham

    Alarm Clock( )

    Rajiv Abraham, Apr 23, 2010, in forum: Ruby
    Replies:
    1
    Views:
    189
    Brian Candler
    Apr 23, 2010
  5. M Weaver

    waitpid interruped by "Alarm clock"

    M Weaver, Jul 8, 2004, in forum: Perl Misc
    Replies:
    3
    Views:
    202
    M Weaver
    Jul 10, 2004
Loading...

Share This Page