Cool perl modules in the Sys:: tree
23 September 2005 13:40
Went digging through Sys:: modules on CPAN today and found some gems:
Sys::RunAlone - Ever written a script that you needed to ensure there was only ever one copy of it running?
use Sys::RunAlone;
...
__END__
and you're done. The module uses the DATA handle in the script as a semaphore. Nice. Fits nicely with the ideals espoused in Damian Conway's sufficiently advanced technology talk.
Sys::RunAlone CPAN page.
Sys::RunUntil - Ever written a script that you only want to run for a specified amount of time, regardless of what it happens to be doing? Forget about forking and calling alarm(), etc. Just:
use Sys::RunUntil '30mW';
to let it run for only 30 minutes (wallclock time). Interested only in CPU time? Then
use Sys::RunUntil '30sC';
and you're good. Nice.
Sys::RunUntil CPAN page
Enjoy!
Comments
|