Script::NeedsRestart - checks mtime of script and it's included files
use Script::NeedsRestart; Script::NeedsRestart->set_logger($log); # optional while (1) { last if Script::NeedsRestart->check_mtimes; # or Script::NeedsRestart->restart_if_needed(); # .... do something sleep(10); }
File modification time based checking of script and included files.
Scans script file and all included Perl modules in %INC for modification timestamp and returns true if any of the files have modification timestamp greater then the script start-up time.
%INC
In case scripts running via any of the daemon tools, check can be an indication when to terminate the loop to initiate auto restarted.
re-exec current script
will re-exec current script if it or any dependent files changed.
setting optional logger, if set, check_mtimes() and restart() will will log their events.
check_mtimes()
restart()
Script::NeedsRestart->set_logger($log);
Jozef Kutej, <jkutej at cpan.org>
<jkutej at cpan.org>
Copyright 2009 Jozef Kutej, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Script::NeedsRestart, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Script::NeedsRestart
CPAN shell
perl -MCPAN -e shell install Script::NeedsRestart
For more information on module installation, please visit the detailed CPAN module installation guide.