line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::UCP::IntTimeout; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
39873
|
use 5.008007; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
97
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
our @EXPORT = qw(); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
7
|
use constant MIN_TIMEOUT => 0; # No timeout at all! |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
104
|
|
15
|
1
|
|
|
1
|
|
5
|
use constant DEFAULT_TIMEOUT => 15; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
16
|
1
|
|
|
1
|
|
5
|
use constant MAX_TIMEOUT => 60; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
278
|
|
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
0
|
0
|
|
sub new { bless({}, shift())->_init(@_); } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _init { |
21
|
0
|
|
|
0
|
|
|
my $self = shift; |
22
|
0
|
|
|
|
|
|
my %opt = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
$self->set($opt{timeout}) if (exists $opt{timeout}); |
25
|
0
|
|
|
|
|
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub set { |
29
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
30
|
0
|
|
0
|
|
|
|
my $timeout = shift || DEFAULT_TIMEOUT; |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
if ($timeout > MAX_TIMEOUT) { |
|
|
0
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$timeout = MAX_TIMEOUT; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
elsif ($timeout < MIN_TIMEOUT) { |
36
|
0
|
|
|
|
|
|
$timeout = MIN_TIMEOUT; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return $self->{timeout} = $timeout; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub get { |
43
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
44
|
0
|
|
|
|
|
|
return $self->{timeout}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
__END__ |