Threads and perl?

Discussion in 'Perl Misc' started by Math55, Oct 30, 2003.

  1. Math55

    Math55 Guest

    hello, i want to use threads in my perl program. i want to build a
    method that compares a time in the future with the current time. if
    both timestamps are equal i want to do something. how could i do that.
    can i do that without threads?

    THANKS:)
     
    Math55, Oct 30, 2003
    #1
    1. Advertising

  2. Math55 wrote:
    > hello, i want to use threads in my perl program.


    Why?

    > i want to build a method that compares a time in the future with
    > the current time. if both timestamps are equal i want to do
    > something. how could i do that.


    This is what I'm doing to have a program run an update routine daily:

    my $currenttime = time;

    open FH, '+< update.txt' or die $!;
    if ($currenttime > <FH>) {
    seek FH, 0, 0;
    print FH updatetime();
    # run update routine
    }
    close FH or die $!;

    sub updatetime {
    # Next day at 3:47 a.m. local time
    require Time::Local;
    return 100000 + Time::Local::timelocal(
    0,0,0,(localtime $currenttime)[3..5]);
    }

    Hope that helps.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Oct 30, 2003
    #2
    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. yoda
    Replies:
    2
    Views:
    445
    =?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=
    Aug 1, 2005
  2. threads without threads

    , Aug 27, 2004, in forum: C Programming
    Replies:
    4
    Views:
    411
    William Ahern
    Aug 27, 2004
  3. Pedro Pinto

    Java Threads - Get running threads

    Pedro Pinto, Apr 8, 2008, in forum: Java
    Replies:
    2
    Views:
    1,453
    Arne Vajhøj
    Apr 9, 2008
  4. Une bévue
    Replies:
    0
    Views:
    156
    Une bévue
    Jun 14, 2006
  5. Dilbert
    Replies:
    0
    Views:
    844
    Dilbert
    Nov 10, 2011
Loading...

Share This Page