NAME
System::Timeout - extend system() to allow timeout after specified seconds
SYNOPSIS
use System::Timeout qw(system system_ex system_log);
system_ex("sleep 9"); # invoke CORE::system, will not timeout exit
system_ex("3", "sleep 9"); # timeout exit after 3 seconds
system("3", "sleep 9"); # just an alias for system_ex, for peoples who want to overlay the Perl build-in
system_log("3", "sleep 9"); # log the command in file
% timeout --timeout=3 "sleep 9" #Run command "Sleep 9" and timeout after 3 seconds
DESCRIPTION
This module extends system() to allow timeout after the specified seconds. This also include a cli tool "timeout" which can be easily used to force command exit after specified seconds. This module is based on core function fork(), exec(), sleep(). These can be useful when invoking system() in daemon.
AUTHOR
Written by ChenGang, yikuyiku.com@gmail.com
COPYRIGHT
Copyright (c) 2011 ChenGang. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.