line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Array::Objectify::Tie; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
59022
|
use strict; |
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
99
|
|
4
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
83
|
|
5
|
4
|
|
|
4
|
|
1995
|
use Anonymous::Object; |
|
4
|
|
|
|
|
34415
|
|
|
4
|
|
|
|
|
262
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our ($ANON, %OBJECTIFY); |
8
|
|
|
|
|
|
|
BEGIN { |
9
|
4
|
|
|
4
|
|
27
|
$ANON = Anonymous::Object->new({ |
10
|
|
|
|
|
|
|
object_name => 'Array::Objectify::Anonymous' |
11
|
|
|
|
|
|
|
}); |
12
|
4
|
|
|
|
|
1846
|
%OBJECTIFY = ( |
13
|
|
|
|
|
|
|
HASH => 'hash_to_nested_object', |
14
|
|
|
|
|
|
|
ARRAY => 'array_to_nested_object', |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub TIEARRAY { |
19
|
3
|
|
|
3
|
|
90
|
my ($class, @params) = @_; |
20
|
3
|
|
|
|
|
10
|
my $self = { |
21
|
|
|
|
|
|
|
array => [ |
22
|
|
|
|
|
|
|
$class->_OBJECTIFY(@params) |
23
|
|
|
|
|
|
|
], |
24
|
|
|
|
|
|
|
}; |
25
|
3
|
|
|
|
|
3503
|
bless $self, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub CLEAR { |
29
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
30
|
1
|
|
|
|
|
15
|
$self->{array} = []; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub STORESIZE { |
34
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
35
|
1
|
|
|
|
|
1
|
return scalar @{$self->{array}}; |
|
1
|
|
|
|
|
5
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub STORE { |
39
|
1
|
|
|
1
|
|
3
|
my ($self, $index, $value) = @_; |
40
|
1
|
|
|
|
|
3
|
($self->{array}->[$index]) = $self->_OBJECTIFY($value); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub FETCHSIZE { |
45
|
6
|
|
|
6
|
|
933
|
my $self = shift; |
46
|
6
|
|
|
|
|
10
|
return scalar @{$self->{array}}; |
|
6
|
|
|
|
|
28
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub FETCH { |
50
|
19
|
|
|
19
|
|
2995
|
my ($self, $index) = @_; |
51
|
19
|
|
|
|
|
333
|
$self->{array}->[$index]; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub PUSH { |
55
|
3
|
|
|
3
|
|
8
|
my $self = shift; |
56
|
3
|
|
|
|
|
6
|
push @{$self->{array}}, $self->_OBJECTIFY(@_); |
|
3
|
|
|
|
|
12
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub POP { |
60
|
1
|
|
|
1
|
|
1
|
my $self = shift; |
61
|
1
|
|
|
|
|
2
|
pop @{$self->{array}}; |
|
1
|
|
|
|
|
4
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub SHIFT { |
65
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
66
|
1
|
|
|
|
|
2
|
shift @{$self->{array}}; |
|
1
|
|
|
|
|
4
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub UNSHIFT { |
70
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
71
|
1
|
|
|
|
|
2
|
unshift @{$self->{array}}, $self->_OBJECTIFY(@_); |
|
1
|
|
|
|
|
3
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _OBJECTIFY { |
75
|
8
|
|
|
8
|
|
42
|
my ($self, @params) = @_; |
76
|
|
|
|
|
|
|
map { |
77
|
8
|
|
|
|
|
15
|
my $method = $OBJECTIFY{ref($_)}; |
|
14
|
|
|
|
|
261203
|
|
78
|
14
|
100
|
|
|
|
85
|
$method ? $ANON->$method($_) : $_; |
79
|
|
|
|
|
|
|
} @params; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |