line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UV::Timer; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '1.902'; |
4
|
|
|
|
|
|
|
|
5
|
10
|
|
|
10
|
|
4526
|
use strict; |
|
10
|
|
|
|
|
26
|
|
|
10
|
|
|
|
|
297
|
|
6
|
10
|
|
|
10
|
|
48
|
use warnings; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
228
|
|
7
|
10
|
|
|
10
|
|
43
|
use Carp (); |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
196
|
|
8
|
10
|
|
|
10
|
|
43
|
use Exporter qw(import); |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
290
|
|
9
|
10
|
|
|
10
|
|
3475
|
use parent 'UV::Handle'; |
|
10
|
|
|
|
|
2237
|
|
|
10
|
|
|
|
|
55
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = (@UV::Timer::EXPORT_XS,); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub repeat { |
14
|
19
|
|
|
19
|
1
|
450
|
my $self = shift; |
15
|
19
|
100
|
|
|
|
123
|
return $self->_get_repeat() unless (@_); |
16
|
2
|
|
|
|
|
11
|
$self->_set_repeat(@_); |
17
|
2
|
|
|
|
|
100242
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub start { |
21
|
35
|
|
|
35
|
1
|
14058
|
my $self = shift; |
22
|
35
|
50
|
|
|
|
280
|
Carp::croak("Can't start a closed handle") if ($self->closed()) ; |
23
|
35
|
|
100
|
|
|
110
|
my $timeout = shift(@_) || 0; |
24
|
35
|
|
100
|
|
|
127
|
my $repeat = shift(@_) || 0; |
25
|
35
|
100
|
|
|
|
83
|
if (@_) { |
26
|
33
|
|
|
|
|
102
|
$self->on('timer', shift); |
27
|
|
|
|
|
|
|
} |
28
|
35
|
|
|
|
|
59
|
my $res; |
29
|
35
|
|
|
|
|
49
|
my $err = do { #catch |
30
|
35
|
|
|
|
|
50
|
local $@; |
31
|
35
|
|
|
|
|
63
|
eval { |
32
|
35
|
|
|
|
|
116
|
$res = $self->_start($timeout, $repeat); |
33
|
35
|
|
|
|
|
54
|
1; |
34
|
|
|
|
|
|
|
}; #try |
35
|
35
|
|
|
|
|
94
|
$@; |
36
|
|
|
|
|
|
|
}; |
37
|
35
|
50
|
|
|
|
86
|
Carp::croak($err) if $err; # throw |
38
|
35
|
|
|
|
|
79
|
return $res; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |