http://journal.mycom.co.jp/news/2009/08/25/061/index.html
へえ〜
sub slow_logic {
sleep int( rand( 40 ) ) + 10;
'OK';
}
use Data::Dumper;
use Time::Out qw( timeout );
my $logic = timeout 30 => \&slow_logic;
print Dumper $logic;
# time perl ./hoge.pl
$VAR1 = undef;
real 0m30.142s
user 0m0.130s
sys 0m0.010s
# time perl ./hoge.pl
$VAR1 = 'OK';
real 0m21.153s
user 0m0.130s
sys 0m0.020s
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/0_pod.t .............. ok
t/0_pod_coverage.t ..... skipped: Test::Pod::Coverage not installed
t/List-MoreUtils-pp.t .. ok
t/List-MoreUtils.t ..... Use of uninitialized value in numeric eq (==) at t/List-MoreUtils.t line 45.
Use of uninitialized value in numeric eq (==) at t/List-MoreUtils.t line 45.
Use of uninitialized value in numeric eq (==) at t/List-MoreUtils.t line 45.
t/List-MoreUtils.t ..... Failed 2173/2173 subtests
Test Summary Report
-------------------
t/List-MoreUtils.t (Wstat: 11 Tests: 0 Failed: 0)
Non-zero wait status: 11
Parse errors: Bad plan. You planned 2173 tests but ran 0.
Files=4, Tests=2164, 9 wallclock secs ( 2.58 usr 0.25 sys + 5.56 cusr 0.54 csys = 8.93 CPU)
Result: FAIL
Failed 1/4 test programs. 0/2164 subtests failed.