line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UV::Timer; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '1.901'; |
4
|
|
|
|
|
|
|
|
5
|
10
|
|
|
10
|
|
4383
|
use strict; |
|
10
|
|
|
|
|
26
|
|
|
10
|
|
|
|
|
302
|
|
6
|
10
|
|
|
10
|
|
47
|
use warnings; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
218
|
|
7
|
10
|
|
|
10
|
|
47
|
use Carp (); |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
179
|
|
8
|
10
|
|
|
10
|
|
42
|
use Exporter qw(import); |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
308
|
|
9
|
10
|
|
|
10
|
|
3385
|
use parent 'UV::Handle'; |
|
10
|
|
|
|
|
2200
|
|
|
10
|
|
|
|
|
54
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = (@UV::Timer::EXPORT_XS,); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub repeat { |
14
|
19
|
|
|
19
|
1
|
499
|
my $self = shift; |
15
|
19
|
100
|
|
|
|
147
|
return $self->_get_repeat() unless (@_); |
16
|
2
|
|
|
|
|
12
|
$self->_set_repeat(@_); |
17
|
2
|
|
|
|
|
100268
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub start { |
21
|
35
|
|
|
35
|
1
|
13609
|
my $self = shift; |
22
|
35
|
50
|
|
|
|
285
|
Carp::croak("Can't start a closed handle") if ($self->closed()) ; |
23
|
35
|
|
100
|
|
|
115
|
my $timeout = shift(@_) || 0; |
24
|
35
|
|
100
|
|
|
125
|
my $repeat = shift(@_) || 0; |
25
|
35
|
100
|
|
|
|
83
|
if (@_) { |
26
|
33
|
|
|
|
|
111
|
$self->on('timer', shift); |
27
|
|
|
|
|
|
|
} |
28
|
35
|
|
|
|
|
60
|
my $res; |
29
|
35
|
|
|
|
|
54
|
my $err = do { #catch |
30
|
35
|
|
|
|
|
50
|
local $@; |
31
|
35
|
|
|
|
|
62
|
eval { |
32
|
35
|
|
|
|
|
156
|
$res = $self->_start($timeout, $repeat); |
33
|
35
|
|
|
|
|
55
|
1; |
34
|
|
|
|
|
|
|
}; #try |
35
|
35
|
|
|
|
|
86
|
$@; |
36
|
|
|
|
|
|
|
}; |
37
|
35
|
50
|
|
|
|
81
|
Carp::croak($err) if $err; # throw |
38
|
35
|
|
|
|
|
71
|
return $res; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |