/usr/share/perl5/Time/Out.pod is in libtime-out-perl 0.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | =head1 NAME
Time::Out - Easily timeout long running operations
=head1 SYNOPSIS
use Time::Out qw(timeout) ;
timeout $nb_secs => sub {
# your code goes were and will be interrupted if it runs
# for more than $nb_secs seconds.
} ;
if ($@){
# operation timed-out
}
=head1 DESCRIPTION
C<Time::Out> provides an easy interface to I<alarm(2)> based timeouts.
Nested timeouts are supported.
=head2 RETURN VALUE
'timeout' returns whatever the code placed inside the block returns:
use Time::Out qw(timeout) ;
my $rc = timeout 5 => sub {
return 7 ;
} ;
# $rc == 7
=head1 C<Time::HiRes>
If C<Time::Out> sees that C<Time::HiRes> has been loaded, it will use
that 'alarm' function (if available) instead of the default one, allowing
float timeout values to be used effectively:
use Time::Out ;
use Time::HiRes ;
timeout 3.1416 => sub {
# ...
} ;
=head1 BUGS
=over 4
=item Blocking I/O on MSWin32
I<alarm(2)> doesn't interrupt blocking I/O on MSWin32, so 'timeout' won't
do that either.
=item @_
One drawback to using 'timeout' is that it masks @_ in the affected code.
This happens because the affected code is actually wrapped inside another
subroutine that provides it's own @_. You can get around this by
specifically passing your @_ (or whatever you want for that matter) to
'timeout' as such:
use Time::Out ;
sub test {
timeout 5, @_ => sub {
print "$_[0]\n" ;
} ;
}
test("hello") ; # will print "hello\n" ;
=back
=head1 SEE ALSO
eval, closures, I<alarm(2)>, L<Sys::AlarmCall>
=head1 AUTHOR
Patrick LeBoutillier, E<lt>patl@cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright 2005-2008 by Patrick LeBoutillier
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
|