line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
36
|
|
|
36
|
|
209
|
use strict; use warnings; |
|
36
|
|
|
36
|
|
62
|
|
|
36
|
|
|
|
|
1511
|
|
|
36
|
|
|
|
|
187
|
|
|
36
|
|
|
|
|
57
|
|
|
36
|
|
|
|
|
1395
|
|
2
|
|
|
|
|
|
|
package YAML::Old::Node; |
3
|
|
|
|
|
|
|
|
4
|
36
|
|
|
36
|
|
24347
|
use YAML::Old::Tag; |
|
36
|
|
|
|
|
93
|
|
|
36
|
|
|
|
|
1267
|
|
5
|
|
|
|
|
|
|
require YAML::Old::Mo; |
6
|
|
|
|
|
|
|
|
7
|
36
|
|
|
36
|
|
214
|
use Exporter; |
|
36
|
|
|
|
|
76
|
|
|
36
|
|
|
|
|
103280
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter YAML::Old::Mo::Object); |
9
|
|
|
|
|
|
|
our @EXPORT = qw(ynode); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub ynode { |
12
|
1820
|
|
|
1820
|
0
|
1980
|
my $self; |
13
|
1820
|
100
|
|
|
|
5240
|
if (ref($_[0]) eq 'HASH') { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
14
|
845
|
|
|
|
|
842
|
$self = tied(%{$_[0]}); |
|
845
|
|
|
|
|
1778
|
|
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
elsif (ref($_[0]) eq 'ARRAY') { |
17
|
58
|
|
|
|
|
86
|
$self = tied(@{$_[0]}); |
|
58
|
|
|
|
|
155
|
|
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
elsif (ref(\$_[0]) eq 'GLOB') { |
20
|
0
|
|
|
|
|
0
|
$self = tied(*{$_[0]}); |
|
0
|
|
|
|
|
0
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
else { |
23
|
917
|
|
|
|
|
1636
|
$self = tied($_[0]); |
24
|
|
|
|
|
|
|
} |
25
|
1820
|
100
|
|
|
|
9521
|
return (ref($self) =~ /^yaml_/) ? $self : undef; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
90
|
|
|
90
|
0
|
6938
|
my ($class, $node, $tag) = @_; |
30
|
90
|
|
|
|
|
120
|
my $self; |
31
|
90
|
|
|
|
|
230
|
$self->{NODE} = $node; |
32
|
90
|
|
|
|
|
349
|
my (undef, $type) = YAML::Old::Mo::Object->node_info($node); |
33
|
90
|
50
|
|
|
|
503
|
$self->{KIND} = (not defined $type) ? 'scalar' : |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
34
|
|
|
|
|
|
|
($type eq 'ARRAY') ? 'sequence' : |
35
|
|
|
|
|
|
|
($type eq 'HASH') ? 'mapping' : |
36
|
|
|
|
|
|
|
$class->die("Can't create YAML::Old::Node from '$type'"); |
37
|
90
|
|
100
|
|
|
356
|
tag($self, ($tag || '')); |
38
|
90
|
100
|
|
|
|
258
|
if ($self->{KIND} eq 'scalar') { |
39
|
13
|
|
|
|
|
70
|
yaml_scalar->new($self, $_[1]); |
40
|
13
|
|
|
|
|
49
|
return \ $_[1]; |
41
|
|
|
|
|
|
|
} |
42
|
77
|
|
|
|
|
167
|
my $package = "yaml_" . $self->{KIND}; |
43
|
77
|
|
|
|
|
296
|
$package->new($self) |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
0
|
0
|
0
|
sub node { $_->{NODE} } |
47
|
0
|
|
|
0
|
0
|
0
|
sub kind { $_->{KIND} } |
48
|
|
|
|
|
|
|
sub tag { |
49
|
181
|
|
|
181
|
0
|
307
|
my ($self, $value) = @_; |
50
|
181
|
100
|
|
|
|
349
|
if (defined $value) { |
51
|
90
|
|
|
|
|
504
|
$self->{TAG} = YAML::Old::Tag->new($value); |
52
|
90
|
|
|
|
|
182
|
return $self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
else { |
55
|
91
|
|
|
|
|
374
|
return $self->{TAG}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
sub keys { |
59
|
6
|
|
|
6
|
0
|
12
|
my ($self, $value) = @_; |
60
|
6
|
50
|
|
|
|
14
|
if (defined $value) { |
61
|
6
|
|
|
|
|
19
|
$self->{KEYS} = $value; |
62
|
6
|
|
|
|
|
115
|
return $self; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else { |
65
|
0
|
|
|
|
|
0
|
return $self->{KEYS}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#============================================================================== |
70
|
|
|
|
|
|
|
package |
71
|
|
|
|
|
|
|
yaml_scalar; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
@yaml_scalar::ISA = qw(YAML::Old::Node); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub new { |
76
|
13
|
|
|
13
|
|
23
|
my ($class, $self) = @_; |
77
|
13
|
|
|
|
|
66
|
tie $_[2], $class, $self; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub TIESCALAR { |
81
|
13
|
|
|
13
|
|
25
|
my ($class, $self) = @_; |
82
|
13
|
|
|
|
|
26
|
bless $self, $class; |
83
|
13
|
|
|
|
|
41
|
$self |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub FETCH { |
87
|
66
|
|
|
66
|
|
93
|
my ($self) = @_; |
88
|
66
|
|
|
|
|
309
|
$self->{NODE} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub STORE { |
92
|
0
|
|
|
0
|
|
0
|
my ($self, $value) = @_; |
93
|
0
|
|
|
|
|
0
|
$self->{NODE} = $value |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#============================================================================== |
97
|
|
|
|
|
|
|
package |
98
|
|
|
|
|
|
|
yaml_sequence; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
@yaml_sequence::ISA = qw(YAML::Old::Node); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub new { |
103
|
10
|
|
|
10
|
|
19
|
my ($class, $self) = @_; |
104
|
10
|
|
|
|
|
16
|
my $new; |
105
|
10
|
|
|
|
|
50
|
tie @$new, $class, $self; |
106
|
10
|
|
|
|
|
44
|
$new |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub TIEARRAY { |
110
|
10
|
|
|
10
|
|
18
|
my ($class, $self) = @_; |
111
|
10
|
|
|
|
|
36
|
bless $self, $class |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub FETCHSIZE { |
115
|
52
|
|
|
52
|
|
89
|
my ($self) = @_; |
116
|
52
|
|
|
|
|
55
|
scalar @{$self->{NODE}}; |
|
52
|
|
|
|
|
295
|
|
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub FETCH { |
120
|
36
|
|
|
36
|
|
54
|
my ($self, $index) = @_; |
121
|
36
|
|
|
|
|
159
|
$self->{NODE}[$index] |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub STORE { |
125
|
0
|
|
|
0
|
|
0
|
my ($self, $index, $value) = @_; |
126
|
0
|
|
|
|
|
0
|
$self->{NODE}[$index] = $value |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub undone { |
130
|
0
|
|
|
0
|
|
0
|
die "Not implemented yet"; # XXX |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
*STORESIZE = *POP = *PUSH = *SHIFT = *UNSHIFT = *SPLICE = *DELETE = *EXISTS = |
134
|
|
|
|
|
|
|
*STORESIZE = *POP = *PUSH = *SHIFT = *UNSHIFT = *SPLICE = *DELETE = *EXISTS = |
135
|
|
|
|
|
|
|
*undone; # XXX Must implement before release |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#============================================================================== |
138
|
|
|
|
|
|
|
package |
139
|
|
|
|
|
|
|
yaml_mapping; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
@yaml_mapping::ISA = qw(YAML::Old::Node); |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub new { |
144
|
67
|
|
|
67
|
|
104
|
my ($class, $self) = @_; |
145
|
67
|
|
|
|
|
102
|
@{$self->{KEYS}} = sort keys %{$self->{NODE}}; |
|
67
|
|
|
|
|
210
|
|
|
67
|
|
|
|
|
362
|
|
146
|
67
|
|
|
|
|
114
|
my $new; |
147
|
67
|
|
|
|
|
268
|
tie %$new, $class, $self; |
148
|
67
|
|
|
|
|
359
|
$new |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub TIEHASH { |
152
|
67
|
|
|
67
|
|
103
|
my ($class, $self) = @_; |
153
|
67
|
|
|
|
|
195
|
bless $self, $class |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub FETCH { |
157
|
204
|
|
|
204
|
|
345
|
my ($self, $key) = @_; |
158
|
204
|
100
|
|
|
|
695
|
if (exists $self->{NODE}{$key}) { |
159
|
159
|
50
|
|
|
|
266
|
return (grep {$_ eq $key} @{$self->{KEYS}}) |
|
311
|
|
|
|
|
1477
|
|
|
159
|
|
|
|
|
369
|
|
160
|
|
|
|
|
|
|
? $self->{NODE}{$key} : undef; |
161
|
|
|
|
|
|
|
} |
162
|
45
|
|
|
|
|
182
|
return $self->{HASH}{$key}; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub STORE { |
166
|
24
|
|
|
24
|
|
83
|
my ($self, $key, $value) = @_; |
167
|
24
|
100
|
|
|
|
92
|
if (exists $self->{NODE}{$key}) { |
|
|
50
|
|
|
|
|
|
168
|
1
|
|
|
|
|
2
|
$self->{NODE}{$key} = $value; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
elsif (exists $self->{HASH}{$key}) { |
171
|
0
|
|
|
|
|
0
|
$self->{HASH}{$key} = $value; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
else { |
174
|
23
|
100
|
|
|
|
27
|
if (not grep {$_ eq $key} @{$self->{KEYS}}) { |
|
31
|
|
|
|
|
77
|
|
|
23
|
|
|
|
|
52
|
|
175
|
22
|
|
|
|
|
24
|
push(@{$self->{KEYS}}, $key); |
|
22
|
|
|
|
|
43
|
|
176
|
|
|
|
|
|
|
} |
177
|
23
|
|
|
|
|
60
|
$self->{HASH}{$key} = $value; |
178
|
|
|
|
|
|
|
} |
179
|
24
|
|
|
|
|
161
|
$value |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub DELETE { |
183
|
1
|
|
|
1
|
|
9
|
my ($self, $key) = @_; |
184
|
1
|
|
|
|
|
2
|
my $return; |
185
|
1
|
50
|
|
|
|
4
|
if (exists $self->{NODE}{$key}) { |
|
|
0
|
|
|
|
|
|
186
|
1
|
|
|
|
|
3
|
$return = $self->{NODE}{$key}; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
elsif (exists $self->{HASH}{$key}) { |
189
|
0
|
|
|
|
|
0
|
$return = delete $self->{NODE}{$key}; |
190
|
|
|
|
|
|
|
} |
191
|
1
|
|
|
|
|
3
|
for (my $i = 0; $i < @{$self->{KEYS}}; $i++) { |
|
4
|
|
|
|
|
12
|
|
192
|
3
|
100
|
|
|
|
10
|
if ($self->{KEYS}[$i] eq $key) { |
193
|
1
|
|
|
|
|
2
|
splice(@{$self->{KEYS}}, $i, 1); |
|
1
|
|
|
|
|
4
|
|
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
} |
196
|
1
|
|
|
|
|
42
|
return $return; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub CLEAR { |
200
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
201
|
0
|
|
|
|
|
0
|
@{$self->{KEYS}} = (); |
|
0
|
|
|
|
|
0
|
|
202
|
0
|
|
|
|
|
0
|
%{$self->{HASH}} = (); |
|
0
|
|
|
|
|
0
|
|
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub FIRSTKEY { |
206
|
181
|
|
|
181
|
|
360
|
my ($self) = @_; |
207
|
181
|
|
|
|
|
564
|
$self->{ITER} = 0; |
208
|
181
|
|
|
|
|
646
|
$self->{KEYS}[0] |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub NEXTKEY { |
212
|
301
|
|
|
301
|
|
366
|
my ($self) = @_; |
213
|
301
|
|
|
|
|
1609
|
$self->{KEYS}[++$self->{ITER}] |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
sub EXISTS { |
217
|
59
|
|
|
59
|
|
113
|
my ($self, $key) = @_; |
218
|
59
|
|
|
|
|
268
|
exists $self->{NODE}{$key} |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
1; |