Threads and perl?

M

Math55

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:)
 
G

Gunnar Hjalmarsson

Math55 said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top