line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::IPAddress::Util::Collection::Tie; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
87
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
67
|
|
5
|
3
|
|
|
3
|
|
46
|
use 5.010; |
|
3
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
17
|
use Carp qw( confess ); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
2696
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Net::IPAddress::Util; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
23
|
|
|
23
|
1
|
65
|
my $class = shift; |
13
|
23
|
|
33
|
|
|
117
|
$class = ref($class) || $class; |
14
|
23
|
|
|
|
|
59
|
my ($arg_ref) = @_; |
15
|
23
|
|
|
|
|
131
|
return bless $arg_ref => $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub TIEARRAY { |
19
|
23
|
|
|
23
|
|
82
|
my ($class, $contents) = @_; |
20
|
23
|
50
|
|
|
|
75
|
$contents = [] unless defined $contents; |
21
|
23
|
|
|
|
|
55
|
@{$contents} = map { _checktype($_) } @{$contents}; |
|
23
|
|
|
|
|
66
|
|
|
21
|
|
|
|
|
56
|
|
|
23
|
|
|
|
|
68
|
|
22
|
23
|
|
|
|
|
183
|
my $self = $class->new({ contents => $contents }); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub FETCH { |
26
|
129
|
|
|
129
|
|
296
|
my ($self, $i) = @_; |
27
|
129
|
|
|
|
|
453
|
return $self->{ contents }->[ $i ]; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub STORE { |
31
|
0
|
|
|
0
|
|
0
|
my ($self, $i, $v) = @_; |
32
|
0
|
|
|
|
|
0
|
$self->{ contents }->[ $i ] = _checktype($v); |
33
|
0
|
|
|
|
|
0
|
return $v; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub FETCHSIZE { |
37
|
28
|
|
|
28
|
|
95
|
my ($self) = @_; |
38
|
28
|
|
|
|
|
55
|
return scalar @{$self->{ contents }}; |
|
28
|
|
|
|
|
152
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub EXISTS { |
42
|
0
|
|
|
0
|
|
0
|
my ($self, $i) = @_; |
43
|
0
|
|
|
|
|
0
|
return exists $self->{ contents }->[ $i ]; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub DELETE { |
47
|
0
|
|
|
0
|
|
0
|
my ($self, $i) = @_; |
48
|
0
|
|
|
|
|
0
|
return delete $self->{ contents }->[ $i ]; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub CLEAR { |
52
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
53
|
0
|
|
|
|
|
0
|
$self->{ contents } = [ ]; |
54
|
0
|
|
|
|
|
0
|
return $self->{ contents }; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub PUSH { |
58
|
34
|
|
|
34
|
|
121
|
my ($self, @l) = @_; |
59
|
34
|
|
|
|
|
74
|
push @{$self->{ contents }}, map { _checktype($_) } @l; |
|
34
|
|
|
|
|
116
|
|
|
90
|
|
|
|
|
244
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub POP { |
63
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
64
|
0
|
|
|
|
|
0
|
return pop @{$self->{ contents }}; |
|
0
|
|
|
|
|
0
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub UNSHIFT { |
68
|
0
|
|
|
0
|
|
0
|
my ($self, @l) = @_; |
69
|
0
|
|
|
|
|
0
|
unshift @{$self->{ contents }}, map { _checktype($_) } @l; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub SHIFT { |
73
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
74
|
0
|
|
|
|
|
0
|
return shift @{$self->{ contents }}; |
|
0
|
|
|
|
|
0
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub SPLICE { |
78
|
0
|
|
|
0
|
|
0
|
my ($self, $offset, $length, @l) = @_; |
79
|
0
|
0
|
|
|
|
0
|
$offset = 0 unless defined $offset; |
80
|
0
|
0
|
|
|
|
0
|
$length = $self->FETCHSIZE() - $offset unless defined $length; |
81
|
0
|
|
|
|
|
0
|
return splice @{$self->{ contents }}, $offset, $length, map { _checktype($_) } @l; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub _checktype { |
85
|
111
|
|
|
111
|
|
245
|
my ($v) = @_; |
86
|
111
|
50
|
|
|
|
635
|
return $v if ref($v) eq 'Net::IPAddress::Util::Range'; |
87
|
0
|
0
|
|
|
|
|
if (ref($v) eq 'HASH') { |
88
|
0
|
|
|
|
|
|
eval { $v = Net::IPAddress::Util::Range->new($v) }; |
|
0
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
} |
90
|
0
|
0
|
0
|
|
|
|
if (!ref($v) or ref($v) eq 'ARRAY') { |
91
|
0
|
|
|
|
|
|
eval { $v = Net::IPAddress::Util->new($v) }; |
|
0
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
} |
93
|
0
|
0
|
|
|
|
|
if (ref($v) eq 'Net::IPAddress::Util') { |
94
|
0
|
|
|
|
|
|
$v = Net::IPAddress::Util::Range->new({ ip => $v }); |
95
|
|
|
|
|
|
|
} |
96
|
0
|
0
|
0
|
|
|
|
if (!defined($v) or ref($v) ne 'Net::IPAddress::Util::Range') { |
97
|
0
|
0
|
0
|
|
|
|
my $disp = defined($v) ? (ref($v) || 'bare scalar') : 'undef()'; |
98
|
0
|
|
|
|
|
|
confess("Invalid data type ($disp)"); |
99
|
|
|
|
|
|
|
} |
100
|
0
|
|
|
|
|
|
return $v; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__ |