You are missing the conceptual loophole here.
> print something();
So what if something() takes longer than a second?
Your sleep would just skip the missed steps till the following interval.
The clean approach would be to include an exception handling.
Apart from this could the OS be too busy to return in time, that's why sleep only guaranties minimal time.
See Re: missing second of time
> I wonder if the perldoc for sleep should add ...
All these conditions might not be true in your case, but how do you want to include the general case in the docs???
I think this use cases are best covered in a dedicated module.
Might be interesting to compare how setInterval() in JS is handling those cases.
From what I read after searching JS setInterval long running function it seems that delayed calls are queued to be executed later, and this without raising an exception. ... Ugly.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re^3: missing second of time
by LanX
in thread missing second of time
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |