line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
25
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
185
|
|
2
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
326
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package JSON::String::ARRAY; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.1.0_04'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use JSON::String::BaseHandler |
9
|
5
|
|
|
|
|
41
|
'_reencode', |
10
|
|
|
|
|
|
|
'_recurse_wrap_value', |
11
|
5
|
|
|
5
|
|
1848
|
'constructor' => { type => 'ARRAY', -as => '_constructor' }; |
|
5
|
|
|
|
|
13
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
BEGIN { |
14
|
5
|
|
|
5
|
|
2873
|
*TIEARRAY = \&_constructor; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub FETCH { |
18
|
109
|
|
|
109
|
|
11329
|
my($self, $idx) = @_; |
19
|
109
|
|
|
|
|
280
|
return $self->{data}->[$idx]; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub STORE { |
23
|
20
|
|
|
20
|
|
6186
|
my($self, $idx, $val) = @_; |
24
|
20
|
|
|
|
|
85
|
$self->{data}->[$idx] = $self->_recurse_wrap_value($val); |
25
|
20
|
|
|
|
|
47
|
$self->_reencode; |
26
|
20
|
|
|
|
|
46
|
return $val; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub FETCHSIZE { |
30
|
91
|
|
|
91
|
|
3597
|
return scalar @{shift->{data}}; |
|
91
|
|
|
|
|
216
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub STORESIZE { |
34
|
1
|
|
|
1
|
|
2
|
my($self, $len) = @_; |
35
|
1
|
|
|
|
|
3
|
$#{$self->{data}} = $len - 1; |
|
1
|
|
|
|
|
3
|
|
36
|
1
|
|
|
|
|
3
|
$self->_reencode; |
37
|
1
|
|
|
|
|
2
|
return $len; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
1
|
|
5
|
sub EXTEND { goto &STORESIZE } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub EXISTS { |
43
|
0
|
|
|
0
|
|
0
|
my($self, $idx) = @_; |
44
|
0
|
|
|
|
|
0
|
return($self->FETCHSIZE < $idx); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub DELETE { |
48
|
0
|
|
|
0
|
|
0
|
my($self, $idx) = @_; |
49
|
0
|
|
|
|
|
0
|
my $val = $self->{data}->[$idx]; |
50
|
0
|
|
|
|
|
0
|
$self->{data}->[$idx] = undef; |
51
|
0
|
|
|
|
|
0
|
return $val; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub CLEAR { |
55
|
1
|
|
|
1
|
|
323
|
my $self = shift; |
56
|
1
|
|
|
|
|
2
|
@{$self->{data}} = (); |
|
1
|
|
|
|
|
3
|
|
57
|
1
|
|
|
|
|
3
|
$self->_reencode; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub PUSH { |
61
|
1
|
|
|
1
|
|
381
|
my $self = shift; |
62
|
1
|
|
|
|
|
2
|
my $rv = push @{$self->{data}}, @_; |
|
1
|
|
|
|
|
4
|
|
63
|
1
|
|
|
|
|
3
|
$self->_reencode; |
64
|
1
|
|
|
|
|
3
|
return $rv; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub POP { |
68
|
1
|
|
|
1
|
|
297
|
my $self = shift; |
69
|
1
|
|
|
|
|
1
|
my $rv = pop @{$self->{data}}; |
|
1
|
|
|
|
|
3
|
|
70
|
1
|
|
|
|
|
2
|
$self->_reencode; |
71
|
1
|
|
|
|
|
2
|
return $rv; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub SHIFT { |
75
|
1
|
|
|
1
|
|
366
|
my $self = shift; |
76
|
1
|
|
|
|
|
1
|
my $rv = shift @{$self->{data}}; |
|
1
|
|
|
|
|
2
|
|
77
|
1
|
|
|
|
|
4
|
$self->_reencode; |
78
|
1
|
|
|
|
|
3
|
return $rv; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub UNSHIFT { |
82
|
1
|
|
|
1
|
|
285
|
my $self = shift; |
83
|
1
|
|
|
|
|
3
|
my $rv = unshift @{$self->{data}}, @_; |
|
1
|
|
|
|
|
4
|
|
84
|
1
|
|
|
|
|
3
|
$self->_reencode; |
85
|
1
|
|
|
|
|
3
|
return $rv; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub SPLICE { |
89
|
0
|
|
|
0
|
|
|
my $self = shift; |
90
|
0
|
|
|
|
|
|
my @rv; |
91
|
0
|
0
|
|
|
|
|
if (wantarray) { |
92
|
0
|
|
|
|
|
|
@rv = splice @{$self}, @_; |
|
0
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} else { |
94
|
0
|
|
|
|
|
|
$rv[0] = splice @{$self}, @_; |
|
0
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
$self->_reencode; |
98
|
|
|
|
|
|
|
|
99
|
0
|
0
|
|
|
|
|
return( wantarray ? @rv : $rv[0] ); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=pod |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 NAME |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
JSON::String::ARRAY - Handle arrays for JSON::String |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 DESCRIPTION |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This module is not intended to be used directly. It is used by |
113
|
|
|
|
|
|
|
L to tie behavior to an array. Any time the array is changed, |
114
|
|
|
|
|
|
|
the top-level data structure is re-encoded and the serialized representation |
115
|
|
|
|
|
|
|
saved back to the original location. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 SEE ALSO |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
L, L |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHOR |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Anthony Brummett |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 COPYRIGHT |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Copyright 2015, Anthony Brummett. This module is free software. It may |
128
|
|
|
|
|
|
|
be used, redistributed and/or modified under the same terms as Perl itself. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |