line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
20
|
use strict; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
153
|
|
2
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
263
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package JSON::String::ARRAY; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.1.0_03'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use JSON::String::BaseHandler |
9
|
5
|
|
|
|
|
42
|
'_reencode', |
10
|
|
|
|
|
|
|
'_recurse_wrap_value', |
11
|
5
|
|
|
5
|
|
1477
|
'constructor' => { type => 'ARRAY', -as => '_constructor' }; |
|
5
|
|
|
|
|
11
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
BEGIN { |
14
|
5
|
|
|
5
|
|
2897
|
*TIEARRAY = \&_constructor; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub FETCH { |
18
|
109
|
|
|
109
|
|
8996
|
my($self, $idx) = @_; |
19
|
109
|
|
|
|
|
282
|
return $self->{data}->[$idx]; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub STORE { |
23
|
20
|
|
|
20
|
|
6380
|
my($self, $idx, $val) = @_; |
24
|
20
|
|
|
|
|
48
|
$self->{data}->[$idx] = $self->_recurse_wrap_value($val); |
25
|
20
|
|
|
|
|
44
|
$self->_reencode; |
26
|
20
|
|
|
|
|
37
|
return $val; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub FETCHSIZE { |
30
|
91
|
|
|
91
|
|
3596
|
return scalar @{shift->{data}}; |
|
91
|
|
|
|
|
212
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub STORESIZE { |
34
|
1
|
|
|
1
|
|
2
|
my($self, $len) = @_; |
35
|
1
|
|
|
|
|
1
|
$#{$self->{data}} = $len - 1; |
|
1
|
|
|
|
|
4
|
|
36
|
1
|
|
|
|
|
3
|
$self->_reencode; |
37
|
1
|
|
|
|
|
2
|
return $len; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
1
|
|
4
|
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
|
|
288
|
my $self = shift; |
56
|
1
|
|
|
|
|
2
|
@{$self->{data}} = (); |
|
1
|
|
|
|
|
3
|
|
57
|
1
|
|
|
|
|
3
|
$self->_reencode; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub PUSH { |
61
|
1
|
|
|
1
|
|
305
|
my $self = shift; |
62
|
1
|
|
|
|
|
1
|
my $rv = push @{$self->{data}}, @_; |
|
1
|
|
|
|
|
4
|
|
63
|
1
|
|
|
|
|
3
|
$self->_reencode; |
64
|
1
|
|
|
|
|
2
|
return $rv; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub POP { |
68
|
1
|
|
|
1
|
|
326
|
my $self = shift; |
69
|
1
|
|
|
|
|
1
|
my $rv = pop @{$self->{data}}; |
|
1
|
|
|
|
|
3
|
|
70
|
1
|
|
|
|
|
3
|
$self->_reencode; |
71
|
1
|
|
|
|
|
2
|
return $rv; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub SHIFT { |
75
|
1
|
|
|
1
|
|
287
|
my $self = shift; |
76
|
1
|
|
|
|
|
2
|
my $rv = shift @{$self->{data}}; |
|
1
|
|
|
|
|
2
|
|
77
|
1
|
|
|
|
|
3
|
$self->_reencode; |
78
|
1
|
|
|
|
|
2
|
return $rv; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub UNSHIFT { |
82
|
1
|
|
|
1
|
|
288
|
my $self = shift; |
83
|
1
|
|
|
|
|
1
|
my $rv = unshift @{$self->{data}}, @_; |
|
1
|
|
|
|
|
4
|
|
84
|
1
|
|
|
|
|
3
|
$self->_reencode; |
85
|
1
|
|
|
|
|
2
|
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 |