line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UV; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '1.902'; |
4
|
|
|
|
|
|
|
our $XS_VERSION = $VERSION; |
5
|
|
|
|
|
|
|
|
6
|
43
|
|
|
43
|
|
905510
|
use strict; |
|
43
|
|
|
|
|
179
|
|
|
43
|
|
|
|
|
1300
|
|
7
|
43
|
|
|
43
|
|
220
|
use warnings; |
|
43
|
|
|
|
|
75
|
|
|
43
|
|
|
|
|
994
|
|
8
|
43
|
|
|
43
|
|
199
|
use Carp (); |
|
43
|
|
|
|
|
83
|
|
|
43
|
|
|
|
|
945
|
|
9
|
43
|
|
|
43
|
|
203
|
use Exporter qw(import); |
|
43
|
|
|
|
|
97
|
|
|
43
|
|
|
|
|
26890
|
|
10
|
|
|
|
|
|
|
require XSLoader; |
11
|
|
|
|
|
|
|
XSLoader::load('UV', $XS_VERSION); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
14
|
|
|
|
|
|
|
@UV::EXPORT_XS, |
15
|
|
|
|
|
|
|
qw(default_loop loop err_name hrtime strerr translate_sys_error), |
16
|
|
|
|
|
|
|
qw(check timer), |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# _parse_args (static, private) |
20
|
|
|
|
|
|
|
sub _parse_args { |
21
|
30
|
|
|
30
|
|
56
|
my $args; |
22
|
30
|
50
|
33
|
|
|
328
|
if ( @_ == 1 && ref $_[0] ) { |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
my %copy = eval { %{ $_[0] } }; # try shallow copy |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
24
|
0
|
0
|
|
|
|
0
|
Carp::croak("Argument to method could not be dereferenced as a hash") if $@; |
25
|
0
|
|
|
|
|
0
|
$args = \%copy; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
elsif (@_==1 && !ref($_[0])) { |
28
|
0
|
|
|
|
|
0
|
$args = {single_arg => $_[0]}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif ( @_ % 2 == 0 ) { |
31
|
30
|
|
|
|
|
97
|
$args = {@_}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
0
|
|
|
|
|
0
|
Carp::croak("Method got an odd number of elements"); |
35
|
|
|
|
|
|
|
} |
36
|
30
|
|
|
|
|
83
|
return $args; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub check { |
40
|
1
|
|
|
1
|
1
|
2188
|
require UV::Check; |
41
|
1
|
|
|
|
|
11
|
return UV::Check->new(@_); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub default_loop { |
45
|
18
|
|
|
18
|
1
|
2821
|
require UV::Loop; |
46
|
18
|
|
|
|
|
89
|
return UV::Loop->default(); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub idle { |
50
|
1
|
|
|
1
|
1
|
471
|
require UV::Idle; |
51
|
1
|
|
|
|
|
10
|
return UV::Idle->new(@_); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub loop { |
55
|
2
|
|
|
2
|
1
|
4822
|
require UV::Loop; |
56
|
2
|
|
|
|
|
13
|
return UV::Loop->default(); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub poll { |
60
|
1
|
|
|
1
|
1
|
852
|
require UV::Poll; |
61
|
1
|
|
|
|
|
11
|
return UV::Poll->new(@_); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub prepare { |
65
|
1
|
|
|
1
|
1
|
529
|
require UV::Prepare; |
66
|
1
|
|
|
|
|
10
|
return UV::Prepare->new(@_); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub signal { |
70
|
1
|
|
|
1
|
1
|
488
|
require UV::Signal; |
71
|
1
|
|
|
|
|
12
|
return UV::Signal->new(@_); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub tcp { |
75
|
0
|
|
|
0
|
1
|
0
|
require UV::TCP; |
76
|
0
|
|
|
|
|
0
|
return UV::TCP->new(@_); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub timer { |
80
|
1
|
|
|
1
|
1
|
463
|
require UV::Timer; |
81
|
1
|
|
|
|
|
13
|
return UV::Timer->new(@_); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub tty { |
85
|
0
|
|
|
0
|
1
|
|
require UV::TTY; |
86
|
0
|
|
|
|
|
|
return UV::TTY->new(@_); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub udp { |
90
|
0
|
|
|
0
|
1
|
|
require UV::UDP; |
91
|
0
|
|
|
|
|
|
return UV::UDP->new(@_); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
{ |
95
|
|
|
|
|
|
|
package UV::Exception; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
use overload |
98
|
1
|
|
|
1
|
|
1114
|
'""' => sub { $_[0]->message }, |
99
|
43
|
|
|
43
|
|
55610
|
fallback => 1; |
|
43
|
|
|
|
|
47822
|
|
|
43
|
|
|
|
|
403
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |