line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
24
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
186
|
|
2
|
5
|
|
|
5
|
|
22
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
283
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package JSON::String::HASH; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.1.0_03'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use JSON::String::BaseHandler |
9
|
5
|
|
|
|
|
34
|
'_reencode', |
10
|
|
|
|
|
|
|
'_recurse_wrap_value', |
11
|
5
|
|
|
5
|
|
20
|
'constructor' => { type => 'HASH', -as => 'constructor'}; |
|
5
|
|
|
|
|
9
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
BEGIN { |
14
|
5
|
|
|
5
|
|
2108
|
*TIEHASH = \&constructor; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub FETCH { |
18
|
2223
|
|
|
2223
|
|
4089
|
my($self, $key) = @_; |
19
|
2223
|
|
|
|
|
4591
|
return $self->{data}->{$key}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub STORE { |
23
|
31
|
|
|
31
|
|
3371
|
my($self, $key, $val) = @_; |
24
|
31
|
|
|
|
|
74
|
$self->{data}->{$key} = $self->_recurse_wrap_value($val); |
25
|
31
|
|
|
|
|
69
|
$self->_reencode; |
26
|
30
|
|
|
|
|
67
|
return $val; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub DELETE { |
30
|
1
|
|
|
1
|
|
424
|
my($self, $key) = @_; |
31
|
1
|
|
|
|
|
3
|
my $val = delete $self->{data}->{$key}; |
32
|
1
|
|
|
|
|
4
|
$self->_reencode; |
33
|
1
|
|
|
|
|
3
|
return $val; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub CLEAR { |
37
|
1
|
|
|
1
|
|
368
|
my $self = shift; |
38
|
1
|
|
|
|
|
2
|
%{$self->{data}} = (); |
|
1
|
|
|
|
|
3
|
|
39
|
1
|
|
|
|
|
4
|
$self->_reencode; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub EXISTS { |
43
|
23
|
|
|
23
|
|
196
|
my($self, $key) = @_; |
44
|
23
|
|
|
|
|
46
|
return exists $self->{data}->{$key}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub FIRSTKEY { |
48
|
1106
|
|
|
1106
|
|
2717
|
my $self = shift; |
49
|
1106
|
|
|
|
|
736
|
keys(%{$self->{data}}); # reset the iterator |
|
1106
|
|
|
|
|
1173
|
|
50
|
1106
|
|
|
|
|
808
|
each %{$self->{data}}; |
|
1106
|
|
|
|
|
2312
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
1187
|
|
|
1187
|
|
762
|
sub NEXTKEY { each %{shift->{data}} } |
|
1187
|
|
|
|
|
2499
|
|
54
|
2
|
|
|
2
|
|
253
|
sub SCALAR { scalar( %{ shift->{data} } ) } |
|
2
|
|
|
|
|
15
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=pod |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
JSON::String::HASH - Handle hashes for JSON::String |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This module is not intended to be used directly. It is used by |
67
|
|
|
|
|
|
|
L to tie behavior to an hash. Any time the hash is changed, |
68
|
|
|
|
|
|
|
the top-level data structure is re-encoded and the serialized representation |
69
|
|
|
|
|
|
|
saved back to the original location. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SEE ALSO |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
L, L |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 AUTHOR |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Anthony Brummett |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 COPYRIGHT |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Copyright 2015, Anthony Brummett. This module is free software. It may |
82
|
|
|
|
|
|
|
be used, redistributed and/or modified under the same terms as Perl itself. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |