Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Perl script to run for x hours

by Happy-the-monk (Abbot)
on Sep 27, 2016 at 13:31 UTC ( #1172756=note: print w/replies, xml ) Need Help??


in reply to Perl script to run for x hours

It so much depends on the precision of the job. Is it paramount to finish on time? Is the job to stop in-process when time is running out? Or is it rather unimportant?

Imagine your boss is coming round telling you to manually stamp envelopes for the next two hours. No reprogramming any printers, hands off the keyboard. Take that stamp and stamp away.

So you stamp an envelope each and then look at the clock or your watch, check the two hours haven't passed yet and proceed?

Or you absentmindedly stamp away, always fixing the clock with your eyes and let the stamp fly out of your hands when time's finally out?

In programming, you could calculate the time when to stop, create a sub stampit and a loop checking for the time out to be reached around calling that subroutine... in the first place. In the second, also check for the time inside the stamping routine and when time's out, leave it (i.e. return to end the loop) with the last; command.

Cheers, Sören

Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1172756]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2017-11-23 00:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (327 votes). Check out past polls.

    Notices?