blib/lib/Data/PropertyList.pm

filter: Statementstmt 83.6% 138 / 165 Branchbran 55.6% 59 / 106 Conditioncond 52.1% 12 / 23 MC/DCmcdc 28.5% 4 / 14 Subroutinesub 88.2% 15 / 17 Podpod 100% 2 / 2 totaltotal 70.3% 230 / 327 CC 66 SCAR 38.6
CC
66
Cov
71%
_astext
90.7
_parse_multiline
12.0
_parse_value
11.6
CRAP 47.6
↑ Summary
1 ### Data::PropertyList - Convert arbitrary objects to/from strings.
2  
3 ### Copyright 1996, 1997, 1998 Evolution Online Systems, Inc.
4 # You may use this software for free under the terms of the Artistic License
5  
6 ### Change History
7 # 1998-12-17 Minor doc cleanup; added makefile and tests for distribution.
8 # 1998-10-05 Tweaked output spacing for single-line string arrays.
9 # 1998-10-05 Switched from use of String::Escape::add to direct hash access.
10 # 1998-07-23 Conventionalized POD, switched to yyyy.mm_dd version numbering.
11 # 1998-08-23 On further consideration, this really did belong in Data::*.
12 # 1998-06-11 Improved support for <<HERE strings.
13 # 1998-05-07 Fixed problem with reading "0 = ..." lines in hashes.
14 # 1998-03-03 Replaced $r->class with ref($r) -Simon
15 # 1998-02-28 Initialized _parse_multiline $value to '' to run clean under -w.
16 # 1998-02-25 Version 1.00 - String::PropertyList
17 # 1998-02-25 Moved to String:: and @EXPORT_OK for CPAN distribution - jeremy
18 # 1998-01-28 Fixed variable name typo in _parse_array.
19 # 1998-01-11 Added rudimentary support for comments: full-line comments only
20 # 1998-01-02 Renamed package Data::PropertyList to Text::PropertyList -Simon
21 # 1997-12-08 Removed package Data::Types, use UNIVERSAL::isa instead. -Piglet
22 # 1997-11-19 Added loopback handling to astext; now Supress as XREF TO
23 # 1997-10-28 Updated to use new Text::Escape interface.
24 # 1997-10-21 Documentation cleanup.
25 # 1997-08-17 Moved string escape/unescape code into new Text::Escape. -Simon
26 # 1997-01-2? New fromDictionary parser -Eric
27 # 1997-01-14 New asDictionary function provides closer match to NeXT style.
28 # 1997-01-11 Cloned & cleaned for Inetics; moved I/O to file.pm. V3.0 -Simon
29 # 1996-10-29 Added append flag and trailing \n to write. -Piglet
30 # 1996-08-06 Partial fix for blessed data; treat as basic type. V2.05 -Simon
31 # 1996-07-13 Cleaned up flow, fixed headers.
32 # 1996-06-25 Wrote &write. V2.04 -EJ
33 # 1996-06-23 Converted from Perl 4 library to Perl 5 package. V2.03
34 # 1996-06-18 Iterative line parsing replaces raw recursion. V2.02
35 # 1996-06-15 Clean start with support for nested data structures. V2.01
36 # 1996-05-26 Support for =<< multiline values.
37 # 1996-05-08 Parse key-value pairs into a flat hash. Version 1. -Simon
38  
39 package Data::PropertyList;
40  
41 3 require 5.003;
42 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 3 ▶use vars qw( $VERSION @ISA @EXPORT_OK );
Subroutine BEGIN: called CC=1 SCAR=0.0
45 3 $VERSION = 1998.12_17;
46  
47 3 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 3 push @ISA, qw( Exporter );
49 3 push @EXPORT_OK, qw( astext fromtext );
50  
51 3 ▶use vars qw( $Separator );
Subroutine BEGIN: called CC=1 SCAR=0.0
52 3 $Separator = '.';
53  
54 3 ▶use String::Escape qw( qprintable unprintable );
Subroutine BEGIN: called CC=1 SCAR=0.0
55 3 $String::Escape::Escapes{'astext'} = \&astext;
56 3 $String::Escape::Escapes{'fromtext'} = \&fromtext;
57  
58 ### Writer
59  
60 3 ▶use vars qw( %DRefs %Supress $CurrentDRef $CurrentDepth );
Subroutine BEGIN: called CC=1 SCAR=0.0
61 3 ▶use vars qw( $Indent $ShowClasses $ShowDRefs $Multiline $MaxItems );
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63 # $string = astext($value_or_reference);
64 # $string = astext($value_or_reference, %options);
65 # Write out an object graph in NeXT property list format
66 # Numerous variables are localized, then we recurse.
67 23 ▶sub astext {
Subroutine astext: called CC=5 SCAR=16.1
Pod documented
68 23 my $target = shift;
69 23 my %options = @_;
70  
71 # Options
72 23 local $CurrentDRef = '';
73 23 local $CurrentDepth = 0;
74
75 23 local $Indent = 2;
76
77 23 ▶ local $ShowClasses = $options{'-classes'} if (exists $options{'-classes'} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $options{"-classes"} 0 23 23
78 23 ▶ local $ShowDRefs = $options{'-drefs'} if (exists $options{'-drefs'} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $options{"-drefs"} 8 15 23
79 23 ▶ local $Multiline = $options{'-multiline'} if (exists $options{'-multiline'});
Branch: 1 branch
BranchTrueFalseTotal
if exists $options{"-multiline"} 0 23 23
80 23 ▶ local $MaxItems = $options{'-maxitems'} if (exists $options{'-maxitems'});
Branch: 1 branch
BranchTrueFalseTotal
if exists $options{"-maxitems"} 3 20 23
81
82 # Working scope for this invokation of astext.
83 23 local %DRefs = ();
84 23 local %Supress = ();
85
86 23 _astext( $target )
87 }
88  
89 # $string = _astext($referenceorvalue);
90 571 ▶sub _astext {
Subroutine _astext: called CC=40 SCAR=45.1
91 571 my $target = shift;
92
93 # Write out an "UNDEFINED" comment to signal undefined values;
94 571 ▶ return '/* UNDEFINED */' if (not defined $target);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $target 0 571 571
95
96 # Write out escaped version of non-reference (string or number) values.
97 571 ▶ if ( ! ref($target) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $target) 557 14 571
98 557 ▶ if ( $Multiline and $target =~ /\n.*?\n/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Data::PropertyList::Multiline and $target =~ /\n.*?\n/) { } 0 557 557
Condition33%1/3
$Data::PropertyList::Multiline and $target =~ /\n.*?\n/
!ll&&!rl&&r
55700
MC/DC0%0/2
$Data::PropertyList::Multiline and $target =~ /\n.*?\n/
$Data::PropertyList::Multiline $target =~ /\n.*?\n/
Truth table33%1/3
A and B
A= $Data::PropertyList::MultilineB= $target =~ /\n.*?\n/
ABresult
0X0
100
111
99 0 ▶ return "<<END_OF_TEXT_DELIMITER\n" .
Branch: 1 branch
BranchTrueFalseTotal
$target =~ /\n\Z/ ? : 0 0 0
100 $target . ($target =~ /\n\Z/ ?'':"\n") .
101 " END_OF_TEXT_DELIMITER";
102 } else {
103 557 return qprintable( $target );
104 }
105 }
106
107 # If this is a reference an item written out elsewhere, write an XREF comment
108 return '/* CROSS-REFERENCE TO ' .
109 ( length($DRefs{$target}) ? $DRefs{$target} : 'ROOT' ) .' */'
110 14 ▶ if ( exists $DRefs{$target} and $Supress{$target} );
Branch: 2 branches
BranchTrueFalseTotal
if exists $Data::PropertyList::DRefs{$target} and $Data::PropertyList::Supress{$target} 0 14 14
length $Data::PropertyList::DRefs{$target} ? : 0 0 0
Condition66%2/3
exists $Data::PropertyList::DRefs{$target} and $Data::PropertyList::Supress{$target}
!ll&&!rl&&r
860
MC/DC0%0/2
exists $Data::PropertyList::DRefs{$target} and $Data::PropertyList::Supress{$target}
exists $Data::PropertyList::DRefs{$target} $Data::PropertyList::Supress{$target}
Truth table66%2/3
A and B
A= exists $Data::PropertyList::DRefs{$target}B= $Data::PropertyList::Supress{$target}
ABresult
0X0
100
111
111
112 # Store a relative DRef from the root to here, if we haven't already
113 14 ▶ $DRefs{$target} = $CurrentDRef if ( not exists $DRefs{$target});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Data::PropertyList::DRefs{$target} 8 6 14
114
115 # We're going to show this item, so don't show it again in the future
116 14 $Supress{$target} ++ ;
117
118 # Variable to hold the stringified form of $target.
119 14 my $result = '';
120
121 # Write out DRef if $ShowDRefs is set
122 14 ▶ $result .= "/* DREF $CurrentDRef */ "
Branch: 1 branch
BranchTrueFalseTotal
if $Data::PropertyList::ShowDRefs and length $Data::PropertyList::CurrentDRef 3 11 14
Condition100%3/3
$Data::PropertyList::ShowDRefs and length $Data::PropertyList::CurrentDRef
!ll&&!rl&&r
1013
MC/DC100%2/2
$Data::PropertyList::ShowDRefs and length $Data::PropertyList::CurrentDRef
$Data::PropertyList::ShowDRefs length $Data::PropertyList::CurrentDRef
Truth table100%3/3
A and B
A= $Data::PropertyList::ShowDRefsB= length $Data::PropertyList::CurrentDRef
ABresult
0X0
100
111
123 if ($ShowDRefs and length $CurrentDRef);
124
125 # Any DRefs after this point are separated by dots.
126 14 ▶ local $CurrentDRef = $CurrentDRef . $Separator if ( length $CurrentDRef );
Branch: 1 branch
BranchTrueFalseTotal
if length $Data::PropertyList::CurrentDRef 6 8 14
127
128 # Write out class of item if it's blessed and $ShowClasses is set
129 14 ▶ $result .= "/* CLASS " . ref($target) . " */ " if ($ShowClasses and
Branch: 1 branch
BranchTrueFalseTotal
if $Data::PropertyList::ShowClasses and ref $target and not ref($target) =~ /\A(ARRAY|HASH|SCALAR|REF|CODE)\Z/ 0 14 14
Condition33%2/6
$Data::PropertyList::ShowClasses and ref $target and not ref($target) =~ /\A(ARRAY|HASH|SCALAR|REF|CODE)\Z/
!ll&&!rl&&r
1400
$Data::PropertyList::ShowClasses and ref $target
!ll&&!rl&&r
1400
MC/DC0%0/3
$Data::PropertyList::ShowClasses and ref $target and not ref($target) =~ /\A(ARRAY|HASH|SCALAR|REF|CODE)\Z/
$Data::PropertyList::ShowClasses ref $target not ref($target) =~ /\A(ARRAY|HASH|SCALAR|REF|CODE)\Z/
Truth table25%1/4
A and B and not(C)
A= $Data::PropertyList::ShowClassesB= ref $targetC= not ref($target) =~ /\A(ARRAY|HASH|SCALAR|REF|CODE)\Z/
ABCresult
0XX0
10X0
1100
1111
130 ref($target) and (ref($target) !~ /\A(ARRAY|HASH|SCALAR|REF|CODE)\Z/));
131
132 14 ▶ if ( UNIVERSAL::isa($target, 'HASH') ) {
Branch: 3 branches
BranchTrueFalseTotal
if (UNIVERSAL::isa($target, 'HASH')) { } 6 8 14
elsif (UNIVERSAL::isa($target, 'ARRAY')) { } 8 0 8
elsif (UNIVERSAL::isa($target, 'REF') or UNIVERSAL::isa($target, 'SCALAR')) { } 0 0 0
133 6 my $key;
134 6 foreach $key (sort keys %{$target}) {
135 12 my $value = $target->{$key};
136 12 ▶ next unless (ref $value);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $value 12 0 12
137 0 ▶ $DRefs{$value} = $CurrentDRef . $key unless ( exists $DRefs{$value} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Data::PropertyList::DRefs{$value} 0 0 0
138 0 $Supress{$value} ++;
139 }
140 6 ▶ $result .= "{" if ($CurrentDepth);
Branch: 1 branch
BranchTrueFalseTotal
if $Data::PropertyList::CurrentDepth 6 0 6
141 6 ▶ $result .= "\n" if ($result);
Branch: 1 branch
BranchTrueFalseTotal
if $result 6 0 6
142 6 $CurrentDepth ++;
143 6 foreach $key (sort keys %{$target}) {
144 12 $result .= ' ' x ( ($CurrentDepth - 1) * $Indent);
145 12 local $CurrentDRef = $CurrentDRef . $key;
146 12 ▶ $Supress{$target->{$key}} -- if ( ref $target->{$key} );
Branch: 1 branch
BranchTrueFalseTotal
if ref $target->{$key} 0 12 12
147 12 $result .= _astext($key) . ' = ' . _astext($target->{$key}) .";\n";
148 }
149 6 $CurrentDepth --;
150 6 ▶ $result .= ' 'x(($CurrentDepth-1) * $Indent) . "}" if ($CurrentDepth);
Branch: 1 branch
BranchTrueFalseTotal
if $Data::PropertyList::CurrentDepth 6 0 6
151 6 return $result;
152 }
153
154 elsif ( UNIVERSAL::isa($target, 'ARRAY') ) {
155 8 my $key;
156 # If $MaxItems is set and there are fewer than that many non-ref items
157 8 ▶ my $one_line = ( $MaxItems and $#{$target} <= $MaxItems );
Condition66%2/3
$Data::PropertyList::MaxItems && $#{$target;} <= $Data::PropertyList::MaxItems
!ll&&!rl&&r
503
MC/DC50%1/2
$Data::PropertyList::MaxItems && $#{$target;} <= $Data::PropertyList::MaxItems
$Data::PropertyList::MaxItems $#{$target;} <= $Data::PropertyList::MaxItems
Truth table66%2/3
A && B
A= $Data::PropertyList::MaxItemsB= $#{$target;} <= $Data::PropertyList::MaxItems
ABresult
0X0
100
111
158 8 foreach $key (0 .. $#{$target}) {
159 524 my $value = $target->[$key];
160 524 ▶ next unless (ref $value);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $value 518 6 524
161 6 $one_line = 0;
162 6 ▶ $DRefs{$value} = $CurrentDRef . $key unless ( exists $DRefs{$value} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Data::PropertyList::DRefs{$value} 6 0 6
163 6 $Supress{$value} ++;
164 }
165 8 ▶ my $joiner = ( $one_line ) ? " " : "\n";
Branch: 1 branch
BranchTrueFalseTotal
$one_line ? : 3 5 8
166 8 ▶ $result .= "(" if ( $CurrentDepth );
Branch: 1 branch
BranchTrueFalseTotal
if $Data::PropertyList::CurrentDepth 0 8 8
167 8 ▶ $result .= $joiner if ( $result );
Branch: 1 branch
BranchTrueFalseTotal
if $result 0 8 8
168 8 $CurrentDepth ++;
169 8 foreach $key (0 .. $#{$target}) {
170 524 ▶ $result .= $one_line ? '' : ' ' x ( ($CurrentDepth - 1) * $Indent);
Branch: 1 branch
BranchTrueFalseTotal
$one_line ? : 259 265 524
171 524 local $CurrentDRef = $CurrentDRef . $key;
172 524 ▶ $Supress{$target->[$key]} -- if ( ref $target->[$key] );
Branch: 1 branch
BranchTrueFalseTotal
if ref $target->[$key] 6 518 524
173 524 $result .= _astext($target->[$key]) . "," . $joiner;
174 }
175 8 $CurrentDepth --;
176 8 ▶ $result .= ( ! $one_line ? ' 'x(($CurrentDepth-1) * $Indent) : '' ) . ")"
Branch: 2 branches
BranchTrueFalseTotal
if $Data::PropertyList::CurrentDepth 0 8 8
!$one_line ? : 0 0 0
177 if ( $CurrentDepth );
178 8 return $result;
179 }
180
181 ▶ elsif (UNIVERSAL::isa($target, 'REF') or UNIVERSAL::isa($target, 'SCALAR')) {
Condition0%0/3
UNIVERSAL::isa($target, "REF") or UNIVERSAL::isa($target, "SCALAR")
l!l&&r!l&&!r
000
MC/DC0%0/2
UNIVERSAL::isa($target, "REF") or UNIVERSAL::isa($target, "SCALAR")
UNIVERSAL::isa($target, "REF") UNIVERSAL::isa($target, "SCALAR")
Truth table0%0/3
A or B
A= UNIVERSAL::isa($target, "REF")B= UNIVERSAL::isa($target, "SCALAR")
ABresult
1X1
011
000
182 0 $result .= '/* REFERENCE */ ';
183 0 local $CurrentDepth = $CurrentDepth + 1;
184 0 local $CurrentDRef = $CurrentDRef . 0;
185 0 $result .= _astext($$target);
186 0 return $result;
187 }
188
189 # Otherwise it's some unsupported kind of reference; just "" stringify it
190 0 return "/* REFERENCE TO $target */";
191 }
192  
193 ### Reader
194  
195 3 ▶use vars qw( @TextLines $LineNumber $Source );
Subroutine BEGIN: called CC=1 SCAR=0.0
196  
197 # $datastructure = fromtext($string);
198 # $datastructure = fromtext($string, %options);
199 # reconstruct an object graph from a NeXT property list.
200 16 ▶sub fromtext ($%) {
Subroutine fromtext: called CC=4 SCAR=14.0
Pod documented
201 16 my $dictionary_text = shift;
202 16 my %options = @_;
203
204 16 local @TextLines = split("\n", $dictionary_text);
205 16 local $LineNumber = 0;
206 16 ▶ local $Source = $options{'-source'} || '';
Condition100%2/2
$options{'-source'} || ''
l!l
115
MC/DC100%1/1
$options{'-source'} || ''
$options{'-source'}
Truth table100%2/2
A
A= $options{'-source'}
Aresult
11
00
207
208 16 ▶ if ( $options{'-scalar'} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($options{'-scalar'}) { } 15 1 16
elsif ($options{'-array'}) { } 1 0 1
209 15 return _parse_value( _get_line() . "\000", "\000" );
210 } elsif ( $options{'-array'} ) {
211 1 return _parse_array();
212 } else {
213 0 return _parse_hash();
214 }
215 }
216  
217 # _parse_error( $message );
218 0 ▶sub _parse_error {
Subroutine _parse_error: not called CC=2 SCAR=17.9
219 0 my $message = shift;
220 0 ▶ warn 'PropertyList error, ' . $message .
Branch: 1 branch
BranchTrueFalseTotal
$Data::PropertyList::Source ? : 0 0 0
221 ' at line ' . $LineNumber . ( $Source ? ' in ' . $Source : '' ) ."\n";
222 }
223  
224 # $text = _get_line;
225 27 ▶sub _get_line {
Subroutine _get_line: called CC=1 SCAR=0.0
226 27 $LineNumber++;
227 27 shift(@TextLines);
228 }
229  
230 # $hash_ref = _parse_hash();
231 3 ▶sub _parse_hash {
Subroutine _parse_hash: called CC=8 SCAR=22.6
232 3 my $hash = {};
233 3 my ($key, $value, $current_line);
234
235 3 ▶ while (@TextLines) {
Branch: 1 branch
BranchTrueFalseTotal
if (@Data::PropertyList::TextLines) 9 0 9
236 9 $current_line = _get_line();
237
238 # Ignore comments
239 9 $current_line =~ s#\Q/*\E.*?\Q*/\E##g;
240
241 # Ignore blank lines
242 9 ▶ next if ( $current_line =~ /^\s*$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $current_line =~ /^\s*$/ 0 9 9
243
244 # If we hit a closing brace, we're done with this hash
245 9 ▶ last if ( $current_line =~ /^\s*\}[,;]/o );
Branch: 1 branch
BranchTrueFalseTotal
if $current_line =~ /^\s*\}[,;]/o 3 6 9
246
247 # Extract key and equals sign.
248 6 ▶ if ( $current_line =~ s/^\s*\"(([^\"\\]|\\.)+)\"//o ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($current_line =~ s/^\s*\"(([^\"\\]|\\.)+)\"//o) { } 0 6 6
elsif ($current_line =~ s/^\s*(\S+)//o) { } 6 0 6
249 0 $key = unprintable( $1 );
250 } elsif ( $current_line =~ s/^\s*(\S+)//o ) {
251 6 $key = unprintable( $1 );
252 } else {
253 0 _parse_error("Key not found");
254 0 last;
255 }
256
257 6 ▶ $current_line =~ s/^\s*=\s*//o or _parse_error("= not found");
Branch: 1 branch
BranchTrueFalseTotal
$current_line =~ s/^\s*=\s*//o or _parse_error("= not found") 6 0 6
258
259 # Extract value
260 6 $value = _parse_value( $current_line, ';' );
261
262 6 ▶ next unless (defined $key);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key 0 6 6
263
264 6 $hash->{$key} = $value;
265 }
266
267 3 return $hash;
268 }
269  
270 # $array_ref = _parse_array();
271 1 ▶sub _parse_array {
Subroutine _parse_array: called CC=4 SCAR=13.9
272 1 my $array = [];
273 1 my ($value, $current_line);
274
275 1 ▶ while (@TextLines) {
Branch: 1 branch
BranchTrueFalseTotal
if (@Data::PropertyList::TextLines) 3 1 4
276 3 $current_line = _get_line();
277
278 # Ignore comments
279 3 $current_line =~ s#\Q/*\E.*?\Q*/\E##g;
280
281 # Ignore blank lines
282 3 ▶ next if ( $current_line =~ /^\s*$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $current_line =~ /^\s*$/ 0 3 3
283
284 # If we hit a closing paren, we're done with this hash
285 3 ▶ last if ( $current_line =~ /^\s*\)[,;]/o );
Branch: 1 branch
BranchTrueFalseTotal
if $current_line =~ /^\s*\)[,;]/o 0 3 3
286
287 # Extract value
288 3 $value = _parse_value( $current_line, ',' );
289
290 3 push( @$array, $value);
291
292 3 next;
293 }
294
295 1 return $array;
296 }
297  
298 # $string = _parse_multiline($ender);
299 0 ▶sub _parse_multiline {
Subroutine _parse_multiline: not called CC=3 SCAR=24.8
300 0 my $ender = shift;
301
302 0 my $value = '';
303 0 my $current_line;
304
305 0 ▶ while (@TextLines) {
Branch: 1 branch
BranchTrueFalseTotal
if (@Data::PropertyList::TextLines) 0 0 0
306 0 $current_line = _get_line();
307 0 ▶ last if ($current_line =~ /^\s*\Q$ender\E[\;\,]?\s*$/);
Branch: 1 branch
BranchTrueFalseTotal
if $current_line =~ /^\s*\Q$ender\E[\;\,]?\s*$/ 0 0 0
308 0 $value .= $current_line . "\n";
309 }
310 0 return $value;
311 }
312  
313 # $value = _parse_value( $value, $terminator );
314 # Extracts a quoted or unquoted string, an array, hash, or a multiline string
315 24 ▶sub _parse_value {
Subroutine _parse_value: called CC=7 SCAR=24.5
316 24 my $current_line = shift;
317 24 my $end_value = shift;
318
319 24 ▶ if ( $current_line =~ /^\s*\"(([^\"\\]|\\.)*)\"\Q$end_value\E\s*/ ) {
Branch: 6 branches
BranchTrueFalseTotal
if ($current_line =~ /^\s*\"(([^\"\\]|\\.)*)\"\Q$end_value\E\s*/) { } 10 14 24
elsif ($current_line =~ /^\s*(\S+?)\Q$end_value\E\s*/) { } 11 3 14
elsif ($current_line =~ m[^\s*(/\*.*?\*/)\s*\Q$end_value\E\s*]) { } 0 3 3
elsif ($current_line =~ /^\s*\{/o) { } 3 0 3
elsif ($current_line =~ /^\s*\(/o) { } 0 0 0
elsif ($current_line =~ /^\s*\<\<(\w+)(?:\Q$end_value\E)?/o) { } 0 0 0
320 # Extract quoted value
321 10 return unprintable( $1 );
322 } elsif ( $current_line =~ /^\s*(\S+?)\Q$end_value\E\s*/ ) {
323 # Extract unquoted value
324 11 return unprintable( $1 );
325 } elsif ( $current_line =~ /^\s*(\/\*.*?\*\/)\s*\Q$end_value\E\s*/ ) {
326 # Extract comment
327 0 return undef;
328 } elsif ( $current_line =~ /^\s*\{/o ) {
329 3 return _parse_hash();
330 } elsif ( $current_line =~ /^\s*\(/o ) {
331 0 return _parse_array();
332 } elsif ( $current_line =~ /^\s*\<\<(\w+)(?:\Q$end_value\E)?/o ) {
333 0 return _parse_multiline($1);
334 } else {
335 0 _parse_error("value not found in '$current_line' - $end_value");
336 }
337 }
338  
339 3 1;
340  
341 __END__
↑ Summary