Branch Coverage

blib/lib/String/PictureFormat.pm
Criterion Covered Total %
branch 145 714 20.3


line true false branch
535 0 8 $ops->{'-bad'} ? :
536 4 4 $pic =~ /^.*?([<|>])/o ? :
537 0 8 $$ops{-'sizefixed'} ? :
538 7 1 if ($pic =~ s/^\@//o) { }
1 0 elsif ($pic =~ s/^\=//o) { }
0 0 elsif ($pic =~ s/^\%//o) { }
539 0 7 if $pic =~ s/^(\d+)\://o
540 0 7 if $fixedLeni
541 1 6 if ($pic =~ s[^([\'\"\/\`])][]o) { }
1 5 elsif ($pic =~ s/^\^//o) { }
1 4 elsif ($pic =~ /^(?:s|tr)(\W)/) { }
1 3 elsif ($pic =~ /^[a-zA-Z_]+/o) { }
543 1 0 $pic =~ s/\Q$regexDelimiter\E(.*)$// ? :
557 0 3 if ($one =~ s/\^/./go) { }
565 0 3 if $one =~ /\+$/o
572 0 1 if ($graball) { }
581 1 0 unless ($leni)
592 0 1 if (length $v0 > $charsHandled || $leni > 0 && length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
593 0 0 $ops->{'-truncate'} =~ /er/io ? :
595 1 0 unless $ops->{'-suffix'} =~ /no/io
596 0 1 wantarray ? :
598 1 0 unless $haveTime2fmtstr
600 1 0 $pic =~ s/\^([^\^]*)$// ? :
603 0 1 if $pic =~ /\^/
605 0 1 if $ops->{'-infmt'}
607 0 1 if ($inpic)
609 0 0 unless $haveFmtstr2time
610 0 0 if $haveFmtstr2time
611 0 0 unless ($perltime or length $v == length $inpic and $inpic =~ /^yyyymmdd(?:hhmm(?:ss)?)?$/i)
614 0 0 wantarray ? :
618 0 1 $v =~ /^\d{9,11}$/o ? :
619 1 0 unless ($perltime)
621 0 1 unless ($t or $perltime)
624 0 0 wantarray ? :
626 0 1 if ($haveTime2fmtstr)
631 1 0 if $perltime
632 1 0 if ($perltime)
633 0 1 if ($haveTime2fmtstr) { }
636 0 0 if ($leni and length $t > $leni and not $ops->{'-truncate'} =~ /no/io) { }
637 0 0 $ops->{'-truncate'} =~ /er/io ? :
642 0 0 unless $ops->{'-suffix'} =~ /no/io
643 0 0 wantarray ? :
650 1 0 if ($t =~ /^\d{8}(?: \d{4,6})?$/o) { }
660 0 1 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
661 0 0 $ops->{'-truncate'} =~ /er/io ? :
664 1 0 unless $ops->{'-suffix'} =~ /no/io
665 0 1 wantarray ? :
669 0 0 wantarray ? :
673 0 1 $pic =~ s/([^$regexDelimiter]+)$// ? :
674 0 1 $suffix =~ s/^(\w+)\;// ? :
677 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
678 0 0 $ops->{'-truncate'} =~ /er/io ? :
680 1 0 unless $ops->{'-suffix'} =~ /no/io
681 0 1 wantarray ? :
683 1 0 $pic =~ s/\)([^\)]*)$/)/ ? :
689 0 1 if ($v =~ /^\d+$/o) { }
702 1 0 unless $pic =~ /^\w+\:\:/o
704 0 1 unless $pic =~ /\(.*\)/o
706 0 1 if $@
707 0 0 if ($leni and length $t > $leni and not $ops->{'-truncate'} =~ /no/io)
708 0 0 $ops->{'-truncate'} =~ /er/io ? :
710 1 0 unless $ops->{'-suffix'} =~ /no/io
711 0 1 wantarray ? :
714 0 3 if ($pic =~ /^\*(.*)$/)
716 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
717 0 0 $ops->{'-truncate'} =~ /er/io ? :
719 0 0 unless $ops->{'-suffix'} =~ /no/io
720 0 0 wantarray ? :
722 2 1 $pic =~ s/([^\<\|\>\.\^]+)$//o ? :
727 3 4 if ($special eq ',') { }
728 3 0 unless $ops->{'-nonnumeric'}
733 0 3 $float =~ /\+\$/o ? :
734 1 2 if ($float =~ /\(/o)
736 0 1 unless $suffix =~ /^\)/o
738 2 1 if ($v < 0) { }
740 2 0 unless $ops->{'-nonnumeric'}
741 2 0 unless $fixedLeni or $leniSpecified
745 1 0 unless $fixedLeni or $leniSpecified
746 1 0 unless $ops->{'-nonnumeric'}
747 0 1 if not $fixedLeni || $leniSpecified and $float =~ s/\(//o
753 3 0 if $two > 0
758 0 0 !$ops->{'-nonnumeric'} && ($commatize || $float =~ /\$/o || $pic =~ /[\.\,\^\$]/o) ? :
761 3 0 unless ($fixedLeni or $leniSpecified)
769 3 0 if ($decPic and not $ops->{'-nonnumeric'}) { }
774 3 0 if $decPic =~ /([\<\|\>])$/o
776 0 0 unless ($pic =~ /\./o or $v =~ /\./)
777 0 0 if $v =~ /^[\+\-\d\. ]+$/o
780 3 0 unless ($float =~ /\+/o)
781 2 1 if $v >= 0 or $suffix =~ /^[\_ ]*CR\s*$/io
785 0 0 if $float =~ s/.(\(?)$/$1/
788 3 0 if ($decJustify eq '>')
794 0 3 if $decLeni < 0
800 0 0 unless ($ops->{'-nonnumeric'})
810 3 0 unless ($ops->{'-nonnumeric'})
812 1 2 if ($v >= 0) { }
818 1 1 if $suffix =~ s/^([\_ ]*)(CR\s*)$/' ' x length($1) . $2;/ie
821 1 2 if $float =~ /[\(\-]/o
826 4 0 unless (not $ops->{'-nonnumeric'} and $t2 eq '(' and $v >= 0)
831 0 0 if $l == $leni and $v < 0 and $float =~ s/\(//o and not $ops->{'-nonnumeric'}
832 3 0 if ($commatize)
834 3 0 if ($decJustify eq '>')
841 6 0 unless $fixedLeni or $leniSpecified
844 0 3 if $switchFloat
845 0 3 if ($ops->{'-truncate'} =~ /er/io and length $t > $leni) { }
3 0 elsif (not $ops->{'-truncate'} =~ /no/io or length $t <= $leni) { }
848 0 3 if not $fixedLeni || $leniSpecified and $float =~ /\(/o
849 0 3 if ($justify eq '|') { }
0 3 elsif ($justify eq '<') { }
852 0 0 wantarray ? :
859 0 0 if not $fixedLeni || $leniSpecified and $float =~ /\(/o
862 2 1 unless $v =~ /\(/o
863 3 0 unless $ops->{'-suffix'} =~ /no/io
864 0 3 wantarray ? :
867 0 1 if $fixedLeni
870 0 1 $pic =~ s/([^wW<|>\d]+)$//o ? :
871 0 1 if $pic =~ /w/o
872 1 0 if $pic =~ /^.*([<|>])/o
875 1 0 unless $fixedLeni
878 0 1 if (length $pic)
879 0 0 !($ops->{'-suffix'} =~ /no/io) ? :
883 1 0 if ($wrapchar eq 'W')
889 0 1 if ($@) { }
893 0 1 if ($justify eq '>') { }
0 1 elsif ($justify eq '|') { }
896 0 0 unless ($ops->{'-suffix'} =~ /no/io)
897 0 0 !$i || $ops->{'-suffix'} =~ /all/io ? :
907 0 0 unless ($ops->{'-suffix'} =~ /no/io)
908 0 0 !$i || $ops->{'-suffix'} =~ /all/io ? :
918 4 0 unless ($ops->{'-suffix'} =~ /no/io)
919 1 3 !$i || $ops->{'-suffix'} =~ /all/io ? :
925 0 1 wantarray ? :
928 0 0 if ($wrapchar eq 'w')
936 0 0 unless ($ops->{'-suffix'} =~ /no/io)
937 0 0 !$j || $ops->{'-suffix'} =~ /all/io ? :
942 0 0 if ($justify eq '>') { }
0 0 elsif ($justify eq '|') { }
951 0 0 wantarray ? :
954 0 0 if $fixedLeni
955 0 0 $pic =~ s/^\$//o ? :
956 0 0 $pic =~ s/^\,//o ? :
957 0 0 $pic =~ s/^(\-?[\d\.]+\w)(.*)$/$1/o ? :
958 0 0 $pic =~ /^\-?(\d+)/ ? :
0 0 unless $fixedLeni
959 0 0 $pic =~ /^\-/o ? :
960 0 0 $lj eq '-' ? :
963 0 0 $pic =~ /\.(\d+)/o ? :
964 0 0 if ($float)
966 0 0 if $pic =~ s/^\%\-/%/o
967 0 0 unless ($fixedLeni)
968 0 0 if $pic =~ /^\%(\d+)/o
973 0 0 if ($commatize) { }
974 0 0 unless ($fixedLeni)
975 0 0 if $pic =~ /^\%(\d+)/o
981 0 0 if ($l > $leni)
983 0 0 wantarray ? :
989 0 0 unless $float
992 0 0 if $float and $l < $leni
994 0 0 unless $ops->{'-suffix'} =~ /no/io
995 0 0 wantarray ? :
1009 0 1 $ops->{'-bad'} ? :
1010 0 1 $pic =~ /^.*?([<|>])/o ? :
1011 0 1 $$ops{-'sizefixed'} ? :
1012 1 0 if ($pic =~ s/^\@//o) { }
0 0 elsif ($pic =~ s/^\=//o) { }
0 0 elsif ($pic =~ s/^\%//o) { }
1013 0 1 if $fixedLeni
1014 0 1 if $pic =~ s/^(\d+)\://o
1016 1 0 if ($pic =~ s[^([\'\"/\`])][]o) { }
0 0 elsif ($pic =~ s/^\^//o) { }
0 0 elsif ($pic =~ /^(?:s|tr)(\W)/) { }
0 0 elsif ($pic =~ /^[a-zA-Z_]+/o) { }
1018 1 0 if $pic =~ s/\Q$regexDelimiter\E(.*)$//
1037 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
1038 0 0 $ops->{'-truncate'} =~ /er/io ? :
1040 0 1 wantarray ? :
1042 0 0 unless $haveFmtstr2time
1044 0 0 $pic =~ s/\^([^\^]*)$// ? :
1047 0 0 if $pic =~ /\^/
1049 0 0 if $ops->{'-outfmt'}
1050 0 0 unless $ops->{'-suffix'} =~ /no/io
1052 0 0 if ($haveFmtstr2time)
1054 0 0 if ($t and $outpic)
1055 0 0 unless $haveTime2fmtstr
1056 0 0 $haveTime2fmtstr ? :
1059 0 0 unless ($t)
1060 0 0 if ($outpic and not $outpic =~ /^yyyymmdd(?:hhmm(?:ss)?)?$/i)
1062 0 0 wantarray ? :
1071 0 0 if index($pic, $i) > 0
1075 0 0 if ($leni and length $t > $leni and not $ops->{'-truncate'} =~ /no/io)
1076 0 0 $ops->{'-truncate'} =~ /er/io ? :
1078 0 0 wantarray ? :
1081 0 0 if $pic =~ s/\Q$regexDelimiter\E(.*)$//
1084 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
1085 0 0 $ops->{'-truncate'} =~ /er/io ? :
1087 0 0 wantarray ? :
1089 0 0 if $pic =~ s/\\\;(.*)$//
1093 0 0 if ($v =~ /^\d+$/o) { }
1104 0 0 unless $pic =~ /^\w+\:\:/o
1106 0 0 unless $pic =~ /\(.*\)/o
1108 0 0 if $@
1110 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
1111 0 0 $ops->{'-truncate'} =~ /er/io ? :
1113 0 0 wantarray ? :
1115 0 0 if ($pic =~ /^\*(.*)$/)
1117 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
1118 0 0 $ops->{'-truncate'} =~ /er/io ? :
1120 0 0 unless $ops->{'-suffix'} =~ /no/io
1121 0 0 wantarray ? :
1123 0 0 if $pic =~ s/([^<|>.]+)$//o
1130 0 0 if ($v =~ /^\D*\-/o) { }
0 0 elsif ($special =~ /\(/o and $v =~ /\(/o) { }
0 0 elsif ($suffix =~ /^[\_ ]*CR\s*$/o and $v =~ s/\s*CR\s*$//o) { }
1135 0 0 unless ($$ops{-'nonnumeric'})
1139 0 0 if $special
1142 0 0 unless $ops->{'-suffix'} =~ /no/io
1144 0 0 if ($isneg)
1145 0 0 unless $v =~ /^\-/o
1151 0 0 if $two > 0
1154 0 0 $pic =~ /^.*?([<|>])/o ? :
1156 0 0 if ($pic =~ /^([<|>]+)[\.\^]([<|>]+)/o) { }
0 0 elsif ($pic =~ /^([\[\<\|\>]+)/o) { }
1159 0 0 unless ($ops->{'-nonnumeric'})
1161 0 0 $two =~ /([\<\|\>])$/o ? :
1162 0 0 if (not $pic =~ /\./o and $v =~ /\./ and $v =~ /^[\+\-\d\. ]+$/o) { }
1163 0 0 if $v =~ /^[\+\-\d\. ]+$/o
1173 0 0 if $leniSpecified and $leni > $leniSpecified
1174 0 0 if ($leni and length $v > $leni)
1175 0 0 if ($decJustify eq '>' and not $ops->{'-nonnumeric'} and $v =~ /^[0-9\+\-]*\.[0-9]+/o)
1178 0 0 unless $v =~ /\./o
1180 0 0 unless length $v
1183 0 0 if ($leni and length $v > $leni)
1184 0 0 unless ($ops->{'-truncate'} =~ /no/io)
1185 0 0 if ($ops->{'-truncate'} =~ /er/io) { }
1188 0 0 if ($justify eq '>') { }
1201 0 0 if ($padcnt > 0)
1202 0 0 if ($justify eq '>') { }
0 0 elsif ($justify eq '|') { }
1206 0 0 $i % 2 ? :
1212 0 0 wantarray ? :
1217 0 0 $pic =~ s/([^wW<|>\d]+)$//o ? :
1218 0 0 if $pic =~ /w/o
1219 0 0 if $pic =~ /^.*([<|>])/o
1221 0 0 if ($justify eq '<') { }
0 0 elsif ($justify eq '>') { }
1229 0 0 if $leni > $leniSpecified
1230 0 0 if ($leni and length $v > $leni) { }
0 0 elsif ($leniSpecified and length $v < $leniSpecified) { }
1231 0 0 unless ($ops->{'-truncate'} =~ /no/io)
1232 0 0 $ops->{'-truncate'} =~ /er/io ? :
1236 0 0 if ($padcnt > 0)
1237 0 0 $justify eq '>' ? :
1240 0 0 wantarray ? :
1242 0 0 $pic =~ s/^\$//o ? :
1243 0 0 $pic =~ s/^\,//o ? :
1244 0 0 if $pic =~ s/^(\-?[\d\.]+\w)(.*)$/$1/o
1245 0 0 $pic =~ /^\-?(\d+)/ ? :
1246 0 0 $pic =~ /^\-/o ? :
1247 0 0 $lj eq '-' ? :
1250 0 0 $pic =~ /\.(\d+)/o ? :
1251 0 0 if ($float)
1253 0 0 if $pic =~ s/^\%\-/%/o
1254 0 0 if $pic =~ /^\%(\d+)/o
1258 0 0 if ($commatize) { }
1259 0 0 if $pic =~ /^\%(\d+)/o
1264 0 0 if ($l > $leni)
1266 0 0 wantarray ? :
1277 0 0 if $float and $l < $leni
1279 0 0 wantarray ? :
1290 1 0 if ($pic =~ s/^\@//o) { }
0 0 elsif ($pic =~ s/^\=//o) { }
0 0 elsif ($pic =~ s/^\%//o) { }
1291 0 1 if ($pic =~ /^(\d+)\:/o) { }
0 1 elsif ($pic =~ s[^([\'\"/\`])][]o) { }
0 1 elsif ($pic =~ s/^\^//o) { }
0 1 elsif ($pic =~ /^(?:s|tr)\W/o) { }
0 1 elsif ($pic =~ /^[a-zA-Z_]+/o) { }
1312 0 1 if $pic =~ /^\*(.*)$/o
1318 1 1 if ($special eq ',') { }
1329 1 0 if $two > 0
1341 0 0 if $pic =~ s/([^wW<|>\d]+)$//o
1342 0 0 if $pic =~ /w/o
1343 0 0 if $pic =~ /^.*([<|>])/o
1348 0 0 $pic =~ s/^\$//o ? :
1349 0 0 $pic =~ s/^\,//o ? :
1350 0 0 $pic =~ s/^(\-?[\d\.]+\w)(.*$)/$1/o ? :
1351 0 0 $pic =~ /^\-?(\d+)/ ? :
1352 0 0 $pic =~ /^\-/o ? :
1355 0 0 if ($float)
1357 0 0 if $pic =~ /^\%(\d+)/o
1359 0 0 if ($commatize)
1360 0 0 if $pic =~ /^\%(\d+)/o
1374 0 0 if ($pic =~ s/^\@//o) { }
0 0 elsif ($pic =~ s/^\=//o) { }
0 0 elsif ($pic =~ s/^\%//o) { }
1376 0 0 if ($pic =~ s[^[\'\"/\`]][]o) { }
0 0 elsif ($pic =~ s/^\^//o) { }
0 0 elsif ($pic =~ /^(?:s|tr)\W/o) { }
0 0 elsif ($pic =~ /^[a-zA-Z_]+/o) { }
1385 0 0 if $pic =~ /^\*(.*)$/
1386 0 0 if $pic =~ s/([^\<\|\>\.\^]+)$//o
1391 0 0 if ($special eq ',') { }
1397 0 0 if ($float =~ /\(/o)
1399 0 0 unless $suffix =~ s/^\)//o
1401 0 0 if ($v < 0) { }
1410 0 0 $pic =~ /^.*?([<|>])/o ? :
1413 0 0 $commatize || $float =~ /\$/o || $pic =~ /[.,\$]/o ? :
1419 0 0 if $pic =~ s/([^wW<|>\d]+)$//o
1420 0 0 if $pic =~ /w/o
1421 0 0 if $pic =~ /^.*([<|>])/o
1424 0 0 $pic =~ s/^\$//o ? :
1425 0 0 $pic =~ s/^\,//o ? :
1426 0 0 $pic =~ s/^(\-?[\d\.]+\w)(.*$)/$1/o ? :
1427 0 0 $pic =~ /^\-?(\d+)/ ? :
1428 0 0 $pic =~ /^\-/o ? :
1443 0 0 if ($pic =~ s/^\@//o) { }
0 0 elsif ($pic =~ s/^\=//o) { }
0 0 elsif ($pic =~ s/^\%//o) { }
1445 0 0 if ($pic =~ s[^([\'\"/\`])][]o) { }
0 0 elsif ($pic =~ s/^\^//o) { }
0 0 elsif ($pic =~ /^(?:s|tr)(\W)/) { }
0 0 elsif ($pic =~ /^[a-zA-Z_]+/o) { }
1447 0 0 if $pic =~ s/\Q$regexDelimiter\E(.*)$//
1451 0 0 $pic =~ s/\^([^\^]*)$// ? :
1456 0 0 if $pic =~ s/([^$regexDelimiter]+)$//
1459 0 0 if $pic =~ s/\)([^\)]*)$/)/o
1462 0 0 if $pic =~ /^\*(.*)$/
1463 0 0 if $pic =~ s/([^<|>.]+)$//o
1469 0 0 if $pic =~ s/([^wW<|>\d]+)$//o
1474 0 0 $pic =~ s/^(\-?[\d\.]+\w)(.*)$/$1/o ? :
1489 0 0 wantarray ? :
0 1 unless $dt =~ /\S/o
1490 0 1 if $dt =~ /\d{9,14}\D*$/o
1491 1 0 if ($dt =~ s[(\d+)[\/\-\.](\d+)[\/\-\.](\d+)][]o) { }
0 0 elsif ($dt =~ s/^(\d\d\d\d\d\d+)(\D+\d+\:?\d+.*)?$/$1/o or $dt =~ s/^(\d{8})(\d{4})/$1/o) { }
1494 0 1 if ($1 < 1000 and $3 < 1000) { }
1 0 elsif ($1 > 1000) { }
1496 0 0 $3 < 80 ? :
1508 1 0 if ($dt =~ s/^\D+(\d\d?)\:?(\d\d?)//o) { }
1511 1 0 $dt =~ s/\:?(\d\d?)//o ? :
1512 1 0 if ($dt =~ /(\s*[ap]m?)/i)
1515 1 0 if $x =~ /\d (\d\d)/
1516 0 1 if ($indicator =~ /a/i and $hr == 12) { }
1 0 elsif ($indicator =~ /p/i and $hr != 12) { }
1543 0 1 unless $then > 0
1544 1 0 wantarray ? :
1549 0 0 if (length $dt == 6) { }
1551 0 0 substr($dt, 0, 2) < 80 ? :
1557 0 0 if ($leftpart < 1300)
1564 0 0 if ($timepart =~ s/^(\d\d)(\d\d)//o or $timepart =~ s/^(\d\d?)\:(\d\d?)\:?//o) { }
1567 0 0 $timepart =~ s/(\d\d?)\s*//o ? :
1568 0 0 if ($timepart =~ /([ap]m?)/io)
1571 0 0 if $dt =~ /\d (\d\d)/
1572 0 0 if ($indicator =~ /a/i and $hr == 12) { }
0 0 elsif ($indicator =~ /p/i and $hr != 12) { }
1595 0 0 unless $then > 0
1596 0 0 wantarray ? :
1600 0 0 wantarray ? :