line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
21
|
use strict; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
195
|
|
2
|
5
|
|
|
5
|
|
19
|
use warnings; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
314
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package JSON::String::HASH; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.1.0_04'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use JSON::String::BaseHandler |
9
|
5
|
|
|
|
|
37
|
'_reencode', |
10
|
|
|
|
|
|
|
'_recurse_wrap_value', |
11
|
5
|
|
|
5
|
|
22
|
'constructor' => { type => 'HASH', -as => 'constructor'}; |
|
5
|
|
|
|
|
8
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
BEGIN { |
14
|
5
|
|
|
5
|
|
2090
|
*TIEHASH = \&constructor; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub FETCH { |
18
|
1201
|
|
|
1201
|
|
3478
|
my($self, $key) = @_; |
19
|
1201
|
|
|
|
|
2644
|
return $self->{data}->{$key}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub STORE { |
23
|
31
|
|
|
31
|
|
3123
|
my($self, $key, $val) = @_; |
24
|
31
|
|
|
|
|
92
|
$self->{data}->{$key} = $self->_recurse_wrap_value($val); |
25
|
31
|
|
|
|
|
77
|
$self->_reencode; |
26
|
30
|
|
|
|
|
62
|
return $val; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub DELETE { |
30
|
1
|
|
|
1
|
|
453
|
my($self, $key) = @_; |
31
|
1
|
|
|
|
|
4
|
my $val = delete $self->{data}->{$key}; |
32
|
1
|
|
|
|
|
5
|
$self->_reencode; |
33
|
1
|
|
|
|
|
4
|
return $val; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub CLEAR { |
37
|
1
|
|
|
1
|
|
455
|
my $self = shift; |
38
|
1
|
|
|
|
|
3
|
%{$self->{data}} = (); |
|
1
|
|
|
|
|
4
|
|
39
|
1
|
|
|
|
|
5
|
$self->_reencode; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub EXISTS { |
43
|
23
|
|
|
23
|
|
225
|
my($self, $key) = @_; |
44
|
23
|
|
|
|
|
57
|
return exists $self->{data}->{$key}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub FIRSTKEY { |
48
|
1106
|
|
|
1106
|
|
2753
|
my $self = shift; |
49
|
1106
|
|
|
|
|
705
|
keys(%{$self->{data}}); # reset the iterator |
|
1106
|
|
|
|
|
1088
|
|
50
|
1106
|
|
|
|
|
786
|
each %{$self->{data}}; |
|
1106
|
|
|
|
|
2551
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
165
|
|
|
165
|
|
113
|
sub NEXTKEY { each %{shift->{data}} } |
|
165
|
|
|
|
|
461
|
|
54
|
2
|
|
|
2
|
|
253
|
sub SCALAR { scalar( %{ shift->{data} } ) } |
|
2
|
|
|
|
|
21
|
|
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 |