line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Future::Timer; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
185162
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
817
|
use utf8; |
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
804
|
use Future; |
|
1
|
|
|
|
|
11435
|
|
|
1
|
|
|
|
|
44
|
|
8
|
1
|
|
|
1
|
|
10
|
use AnyEvent; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
9
|
1
|
|
|
1
|
|
530
|
use AnyEvent::Future; |
|
1
|
|
|
|
|
1086
|
|
|
1
|
|
|
|
|
61
|
|
10
|
1
|
|
|
1
|
|
9
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
11
|
1
|
|
|
1
|
|
7
|
use Time::HiRes qw(time); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
3
|
|
|
3
|
1
|
1932
|
my ($class, $seconds) = @_; |
17
|
|
|
|
|
|
|
|
18
|
3
|
50
|
|
|
|
14
|
croak 'needs seconds as argument' |
19
|
|
|
|
|
|
|
if !defined($seconds); |
20
|
|
|
|
|
|
|
|
21
|
3
|
|
|
|
|
28
|
my $w_ft = AnyEvent::Future->new; |
22
|
3
|
|
|
|
|
35
|
my $start = time(); |
23
|
3
|
|
|
|
|
6
|
my $w; |
24
|
|
|
|
|
|
|
$w = AnyEvent->timer( |
25
|
|
|
|
|
|
|
after => $seconds, |
26
|
|
|
|
|
|
|
cb => sub { |
27
|
0
|
|
|
0
|
|
0
|
$w = undef; |
28
|
0
|
0
|
|
|
|
0
|
$w_ft->done(time() - $start) |
29
|
|
|
|
|
|
|
unless $w_ft->is_ready; |
30
|
|
|
|
|
|
|
} |
31
|
3
|
|
|
|
|
27
|
); |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
5817
|
return $w_ft; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |