Branch Coverage

blib/lib/Data/Rlist.pm
Criterion Covered Total %
branch 420 718 58.5


line true false branch
646 0 150 if exists $Rules{$errrule}
656 15 485 if length $_ < $rule_min
657 21 479 if length $_ > $rule_max
659 0 10 if $rule_min != 2
660 0 10 if $rule_max != 4
673 0 1 defined $Readstruct && exists $$Readstruct{'filename'} ? :
674 0 1 $Data::Rlist::EchoStderr ? :
675 0 0 unless defined $fh
676 0 0 $fh == defined $Data::Rlist::Fh ? :
829 0 139 if @_ & 1
852 0 134 unless defined $v
858 203 1334 unless $attr =~ /^-/
859 985 552 if exists $$self{$attr}
865 0 3788 unless $attr =~ /^-/
870 0 377 if $Data::Rlist::Locked++
872 0 377 if $self->has(-'MaxDepth')
873 0 377 if $self->has(-'SafeCppMode')
874 0 377 if $self->has(-'EchoStderr')
875 0 377 if $self->has(-'RoundScientific')
876 0 377 if $self->has(-'DefaultCsvDelimiter')
877 0 377 if $self->has(-'DefaultConfDelimiter')
878 0 377 if $self->has(-'DefaultConfSeparator')
879 0 377 if $self->has(-'DefaultNanoscriptToken')
880 15 362 if $self->has(-'DEBUG')
881 0 377 if $self->has(-'InputRecordSeparator')
883 115 262 if (not defined wantarray) { }
0 262 elsif (wantarray) { }
1317 134 493 if (ref $input eq 'Data::Rlist') { }
1319 134 0 unless ($fcmd)
1325 18 116 @NStk ? :
1332 0 493 if $Data::Rlist::DEBUG
1333 0 493 if ($Data::Rlist::DEBUG)
1334 0 0 if $fcmd and $fcmdargs
1335 0 0 if $fcmd and not $fcmdargs
1336 0 0 unless $fcmd
1338 1 492 unless &open_input($input, $fcmd, $fcmdargs)
1339 0 492 unless defined $Readstruct
1341 0 0 defined $data ? :
0 492 if $Data::Rlist::DEBUG
1351 24 24 if (ref $input eq 'Data::Rlist') { }
1366 0 24 unless &open_input($input, $fcmd, $fcmdargs)
1367 0 24 unless defined $Readstruct
1381 4 0 if ref $input eq 'Data::Rlist'
1382 0 4 unless ref $options
1390 2 335 if (defined $r and not defined reftype($r)) { }
0 335 elsif (reftype $r ne 'SCALAR') { }
1399 67 1 if $self
1404 0 53 unless defined wantarray
1406 51 2 $self ? :
1407 19 34 wantarray ? :
1420 36 1 if (ref($this) =~ /ARRAY/) { }
1423 0 36 if $Data::Rlist::DEBUG
1425 0 36 if $Data::Rlist::DEBUG
1427 0 1 unless ref($this) =~ /HASH/
1429 0 1 if $Data::Rlist::DEBUG
1431 0 1 if $Data::Rlist::DEBUG
1439 0 1 if ($self)
1441 0 0 if ref $a
1448 15 1 if ($self)
1450 15 0 if ref $a
1457 0 0 if ($self)
1459 0 0 if ref $a
1466 0 4 if ($self)
1468 0 0 if ref $a
1474 0 1 unless defined wantarray
1476 0 1 if ($self)
1478 0 0 if ref $a
1479 0 1 wantarray ? :
1484 0 1250 unless exists $Data::Rlist::PredefinedOptions{$name}
1493 321 603 unless ref $opts
1494 924 0 unless ref $base
1498 924 0 ref $base ? :
1500 2999 10719 unless exists $$opts{$k}
1504 26 898 unless $using_default
1513 0 651 if $Data::Rlist::DEBUG
1515 207 444 if (ref $data eq 'Data::Rlist') { }
1527 0 0 $to_string ? :
1528 86 358 if (not ref $options) { }
1529 81 5 if $options eq 'fast'
1530 0 86 if $options eq 'perl'
1532 5 81 unless $fast or $perl
1536 363 81 unless ($fast or $perl)
1537 41 322 unless defined $$options{'auto_quote'}
1540 108 336 if (not $to_string) { }
1545 0 108 if not defined $output or ref $output
1547 0 108 if ($to_stdout) { }
1548 0 0 unless open $fh, ">$output"
1550 0 108 unless open $fh, ">$output" and flock $fh, 2
1559 49 59 if ref $options and defined $$options{'precision'}
1560 85 23 if ref $options and defined $$options{'eol_space'}
1561 648 324 length $_ ? :
1562 0 108 $to_stdout ? :
49 59 defined $prec ? :
0 108 $header ? :
1574 87 21 if (not $fast || $perl) { }
1575 87 0 if &compile($data, $options, $fh)
1579 21 0 if $fast
1580 0 21 if $perl
1585 0 336 unless not defined $output or ref $output eq 'SCALAR'
1586 276 60 if (not $fast || $perl) { }
1588 0 276 if ref $output
1590 60 0 if $fast
1591 0 60 if $perl
1592 0 60 if ref $output
1603 0 24 unless defined $data
1605 12 12 if (ref $data eq 'Data::Rlist') { }
1623 12 0 if ref $options and defined $$options{'eol_space'}
1625 0 12 unless defined $auto_quote
1626 0 12 if $columns
1627 2260 452 defined $prec ? :
1164 0 $auto_quote ? :
2712 1164 is_number($_) ? :
1628 12 0 if @$data
1633 6 6 if ($to_string) { }
1634 6 0 if (ref $output) { }
1641 0 6 if $Data::Rlist::DEBUG
1642 0 6 if ($to_stdout) { }
1643 0 0 unless open $fh, ">$output"
1645 0 6 unless open $fh, ">$output" and flock $fh, 2
1657 2 0 if ref $data eq 'Data::Rlist'
1659 0 2 unless ref $options
1660 1 1 unless $have_sep
1667 105 231 if (ref $data eq 'Data::Rlist') { }
1679 3 0 if $Data::Rlist::MaxDepth == 0
1685 0 233 if defined $options and $options eq 'perl'
1688 233 0 if $Data::Rlist::MaxDepth == 0
1690 2 231 wantarray ? :
1756 0 517 if defined $rtp and $rtp ne 'SCALAR'
1757 0 517 if $Readstruct
1759 0 517 if $Data::Rlist::DEBUG
1761 517 0 if (defined $input)
1763 138 379 if (not ref $input) { }
1765 138 0 if (not $fcmd) { }
1766 1 137 unless (open $$Readstruct{'fh'}, "<$input" and flock $$Readstruct{'fh'}, 1)
1771 0 0 if $fcmd == 1
1772 0 0 if $fcmdargs
1774 0 0 if ($Data::Rlist::SafeCppMode)
1775 0 0 if ($fcmd =~ /^(gcc|g\+\+|cpp)/i)
1791 0 0 unless open $sedfh, q[sed '] . join('; ', ("s/^\\([ \t][ \t]*\\)#/\\1\\\\#/", 's/^#\\(include\\|pragma\\|if\\|ifdef\\|else\\|endif\\|define\\|undef\\)/ #\\1/', 's/^#/\\\\#/')) . ";' <$input 2>nul |"
1800 0 0 unless open $tmpfh, ">$input"
1809 0 0 unless (open $$Readstruct{'fh'}, "$fcmd $input 2>nul |")
1815 137 1 if (defined $Readstruct)
1824 0 379 if $fcmd
1833 137 379 if $$Readstruct{'fh'}
1834 0 516 if ($$Readstruct{'tmpfile'})
1835 0 0 unless unlink $$Readstruct{'tmpfile'}
1921 0 54120 unless (defined $Ln)
1922 0 0 unless lexln
1925 13446 60503 unless ($C1 = ord $Ln)
1926 492 12954 unless lexln
1929 27822 32681 if ($C1 <= 32)
1931 5752 22070 unless $C1 = ord $Ln
1938 30501 24250 if ($Data::Rlist::REIsPunct[$C1])
1947 13345 10905 if ($Data::Rlist::REIsDigit[$C1])
1948 13328 17 if ($Ln =~ s/$RELexNumber//o) { }
17 0 elsif ($C1 == 45 || $C1 == 46 and $Ln =~ s/$RELexSymbol//o) { }
1962 4237 6668 if ($C1 == 34) { }
218 6450 elsif ($C1 == 60) { }
1984 4237 0 if ($Ln =~ s/$RELexQuotedString//o) { }
1996 0 0 unless (lexln)
2000 0 0 if $Ln =~ s/$RELexQuotedString//o
2004 218 0 if ($Ln =~ s/<<([_\w]+)//io)
2012 218 1993 if ($Ln =~ /^$tok\s*$/m) { }
2018 0 218 if (not $ok) { }
2019 0 0 unless at_eof
2023 42 176 $nanoscript ? :
2030 1123 5327 if ($C1 == 35) { }
0 5327 elsif ($C1 == 47) { }
2033 0 0 if ($Ln =~ m[^/[\*/]]o)
2034 0 0 if $Ln =~ s[^/\*.*\*/\s*][]x
2035 0 0 if ($Ln =~ m[^//]o)
2039 0 0 if ($Ln =~ m[\*/(.*)])
2049 5327 0 if ($Ln =~ s/$RELexSymbol//o)
2060 0 0 if ($ReadFh) { }
0 0 elsif (defined $LnArray and $#$LnArray != -1) { }
2072 6603 9126 if ($ReadFh and not eof $ReadFh) { }
8610 653 elsif (defined $LnArray and $#$LnArray != -1) { }
2074 0 6603 if $Data::Rlist::SafeCppMode
2101 5758 74771 if ($r = $Rules{substr $q, -4}) { }
16062 58709 elsif ($r = $Rules{substr $q, -3}) { }
6050 52659 elsif ($r = $Rules{substr $q, -2}) { }
2148 0 492 if $Data::Rlist::Errors
2150 0 492 if $Data::Rlist::DEBUG
2151 4 488 if (@VStk == 0) { }
2152 0 4 if $Data::Rlist::DEBUG and $q
2156 0 488 if (@VStk > 1) { }
0 488 elsif (not defined $VStk[0]) { }
487 1 elsif ($q eq 'v') { }
2158 0 0 ref $_ ? :
2162 0 0 if $Data::Rlist::DEBUG
2168 9 478 if (not defined $rtp) { }
0 478 elsif (not $rtp =~ /(?:HASH|ARRAY)/) { }
2176 0 488 if $Data::Rlist::DEBUG
2261 160 203 if $$options{'scientific'}
2272 0 363 unless defined $Eol_space
2274 276 87 unless $Data::Rlist::Fh
2279 676 1644 if $Bol_tabs == 0
2290 13254 0 if (defined $v)
2291 1690 11564 if (not $v =~ /$Data::Rlist::REValue/) { }
11564 0 elsif (ord $v != 34) { }
2294 793 897 if ($Here_docs) { }
2295 97 696 if ($v =~ /\n.*\n\z/so) { }
2304 97 0 unless grep {/^$tok/;} @ln
2305 0 0 if ($tok =~ /\d\z/) { }
2308 0 0 !($tok =~ /HERE/) ? :
2319 8684 2880 if ($Auto_quote) { }
1728 1152 elsif (defined $Precision) { }
2320 7244 1440 if ($v =~ /$Data::Rlist::REFloat/) { }
2321 3444 3800 if defined $Precision
2323 0 1440 unless $v =~ /$Data::Rlist::RESymbol/
2327 1632 96 if $v =~ /$Data::Rlist::REFloat/
2341 2007 11521 if (ref $data) { }
11521 0 elsif (defined $data) { }
2344 0 2007 if ($Data::Rlist::MaxDepth >= 1 and $Data::Rlist::MaxDepth < $Data::Rlist::Depth) { }
1262 745 elsif ($Datatype == 65) { }
496 249 elsif ($Datatype == 72) { }
2 247 elsif ($Datatype == 82) { }
2 245 elsif ($Datatype == 83) { }
245 0 elsif ($Datatype == 67) { }
2345 0 0 unless $Data::Rlist::Broken++
2349 0 1262 if (not $cnt) { }
376 886 elsif ($Outline_data > 0 and $Outline_data <= $cnt) { }
2365 3708 376 if $inl
2376 5612 886 if $inl
2379 886 0 if $inl
2384 0 496 if (not @keys) { }
2391 496 2408 unless ($inl)
2392 120 376 if $Outline_hashes and $manykeys
2394 240 256 if $manykeys
2396 240 2664 !($k =~ /$Data::Rlist::REValue/) ? :
2397 240 2664 if (not defined $v) { }
2404 240 256 if $manykeys
2406 248 248 unless $Data::Rlist::Depth
2413 4 241 $Code_refs ? :
2436 651 1731 if (ref $data) { }
1731 0 elsif (defined $data) { }
2439 0 651 if ($Data::Rlist::MaxDepth >= 1 and $Data::Rlist::MaxDepth < $Data::Rlist::Depth) { }
404 247 elsif ($Datatype == 65) { }
167 80 elsif ($Datatype == 72) { }
0 80 elsif ($Datatype == 82) { }
0 80 elsif ($Datatype == 83) { }
80 0 elsif ($Datatype == 67) { }
2440 0 0 unless $Data::Rlist::Broken++
2444 0 404 if (not $cnt) { }
121 283 elsif ($Outline_data > 0 and $Outline_data <= $cnt) { }
2453 381 121 if $inl
2457 0 121 unless $Data::Rlist::Depth
2461 583 283 if $inl
2464 283 0 if $inl
2469 0 167 if (not @keys) { }
2476 167 840 unless ($inl)
2477 41 126 if $Outline_hashes and $manykeys
2479 85 82 if $manykeys
2481 80 927 !($k =~ /$Data::Rlist::REValue/) ? :
2482 80 927 if (not defined $v) { }
2490 85 82 if $manykeys
2492 87 80 unless $Data::Rlist::Depth
2499 0 80 if ($Code_refs) { }
2534 642 0 if (ref $data) { }
0 0 elsif (defined $data) { }
2537 401 241 if ($Datatype == 65) { }
161 80 elsif ($Datatype == 72) { }
0 80 elsif ($Datatype == 82) { }
0 80 elsif ($Datatype == 83) { }
2541 401 0 if (@$data) { }
2545 401 961 if (not $in) { }
2546 1362 0 if (defined $_) { }
2547 240 1122 if (ref $_) { }
2550 162 960 !($_ =~ /$Data::Rlist::REValue/) ? :
2556 161 0 if (%$data) { }
2567 80 881 unless $K =~ /$Data::Rlist::REValue/
2569 881 80 if (defined $V)
2571 321 560 if (ref $V) { }
2574 80 480 unless $V =~ /$Data::Rlist::REValue/
2585 0 0 !($$data =~ /$Data::Rlist::REValue/) ? :
2591 0 0 !($data =~ /$Data::Rlist::REValue/) ? :
2611 0 0 if $s =~ /^["']/
2615 0 0 if (ref $data) { }
0 0 elsif (defined $data) { }
2618 0 0 if ($Datatype == 65) { }
0 0 elsif ($Datatype == 72) { }
0 0 elsif ($Datatype == 82) { }
0 0 elsif ($Datatype == 83) { }
2619 0 0 if (@$data) { }
2623 0 0 if (not $in) { }
2624 0 0 if (defined $_) { }
2625 0 0 if (ref $_) { }
2628 0 0 is_number($_) ? :
2634 0 0 if (%$data) { }
2639 0 0 unless is_number $K
2641 0 0 if (defined $V)
2643 0 0 if (ref $V) { }
2646 0 0 unless is_number $V
2657 0 0 is_number($data) ? :
2663 0 0 is_number($data) ? :
2730 2772 4566 ${$_[0];} =~ /$Data::Rlist::REInteger/ ? :
2731 22734 8942 ${$_[0];} =~ /$Data::Rlist::REFloat/ ? :
2732 0 0 ${$_[0];} =~ /$Data::Rlist::RESymbol/ ? :
2733 3 5 ${$_[0];} =~ /$Data::Rlist::REValue/ ? :
2734 768 396 ${$_[0];} =~ /$Data::Rlist::REValue/ ? :
2797 0 10 if %g_escaped_nonprintables
2828 0 1600 unless s/^\\//
2829 0 1600 if exists $g_escaped_nonprintables{$_}
2833 0 10 unless keys %g_nonprintables_escaped == 160
2834 0 10 unless keys %g_escaped_nonprintables == 160
2860 396 768 &is_random_text(\$_[0]) ? :
2861 792 6960 ord $_[0] == 34 ? :
2870 792 0 ord $_[0] == 34 ? :
2874 3 4368 unless defined $s
2890 0 0 if (/^\s*(?:([^\w\s]+)(\s*).*\n)(?:\s*\1\2?.*\n)+$/) { }
2899 0 0 if ($columns) { }
3026 7757 1 defined $_ ? :
3031 1 0 defined $_ ? :
3090 10011 0 unless defined $prec
3096 2772 4566 if is_integer $a
3097 1 4565 unless defined $prec
3098 768 3798 if $Data::Rlist::RoundScientific
3138 2 2 defined $s ? :
3144 0 2 $anm ? :
3149 0 15723 if $dump
3152 13910 1813 unless ($refs)
3153 10 13900 if (not defined $a) { }
3155 2 8 if (defined $b) { }
3158 0 8 if $dump
3161 0 13900 unless (defined $b)
3165 10011 3889 ($anm = is_number($a)) ? :
3166 0 13900 if $anm and defined $prec
3169 13900 1813 unless (defined $btp)
3170 0 13900 if (not defined $b) { }
3172 0 0 if (defined $a) { }
3175 0 0 if $dump
3178 0 13900 unless (defined $a)
3182 10011 3889 ($bnm = is_number($b)) ? :
3183 0 13900 if $bnm and defined $prec
3187 0 15713 if ($atp ne $btp)
3193 13900 1813 if (not $refs) { }
3194 10011 3889 if ($anm) { }
0 3889 elsif ($a ne $b) { }
0 3889 elsif ($dump) { }
3195 0 10011 defined $prec ? :
3196 0 10011 if (not equal($a, $b)) { }
0 10011 elsif ($dump) { }
3208 0 1813 if $dump
3209 0 1813 if ($atp eq 'SCALAR') { }
597 1216 elsif ($atp eq 'HASH') { }
1216 0 elsif ($atp eq 'ARRAY') { }
0 0 elsif ($atp eq 'REF') { }
3215 0 597 unless ($acnt == $bcnt)
3218 0 597 if $acnt == 0
3225 0 597 if (@a_keys_missing or @b_keys_missing)
3226 0 0 if @a_keys_missing
3227 0 0 if @b_keys_missing
3232 0 3004 if $dump
3236 0 1216 if ($#$a != $#$b) { }
3240 0 12443 if $dump
3283 0 0 if ($? == -1) { }
0 0 elsif ($? & 127) { }
3290 0 0 $coredump ? :
3293 0 0 if $Data::Rlist::DEBUG