Branch Coverage

blib/lib/String/PictureFormat.pm
Criterion Covered Total %
branch 143 710 20.1


line true false branch
533 0 8 $ops->{'-bad'} ? :
534 4 4 $pic =~ /^.*?([<|>])/o ? :
535 0 8 $$ops{-'sizefixed'} ? :
536 7 1 if ($pic =~ s/^\@//o) { }
1 0 elsif ($pic =~ s/^\=//o) { }
0 0 elsif ($pic =~ s/^\%//o) { }
537 0 7 if $pic =~ s/^(\d+)\://o
538 0 7 if $fixedLeni
539 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) { }
541 1 0 $pic =~ s/\Q$regexDelimiter\E(.*)$// ? :
555 0 3 if ($one =~ s/\^/./go) { }
563 0 3 if $one =~ /\+$/o
570 0 1 if ($graball) { }
579 1 0 unless ($leni)
590 0 1 if (length $v0 > $charsHandled || $leni > 0 && length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
591 0 0 $ops->{'-truncate'} =~ /er/io ? :
593 1 0 unless $ops->{'-suffix'} =~ /no/io
594 0 1 wantarray ? :
596 1 0 unless $haveTime2fmtstr
598 1 0 $pic =~ s/\^([^\^]*)$// ? :
601 0 1 if $pic =~ /\^/
603 0 1 if $ops->{'-infmt'}
605 0 1 if ($inpic)
607 0 0 unless $haveFmtstr2time
608 0 0 if $haveFmtstr2time
609 0 0 unless ($perltime or length $v == length $inpic and $inpic =~ /^yyyymmdd(?:hhmm(?:ss)?)?$/i)
612 0 0 wantarray ? :
616 0 1 $v =~ /^\d{9,11}$/o ? :
617 1 0 unless ($perltime)
619 0 1 unless ($t or $perltime)
622 0 0 wantarray ? :
624 0 1 if ($haveTime2fmtstr)
629 1 0 if $perltime
630 1 0 if ($perltime)
631 0 1 if ($haveTime2fmtstr) { }
634 0 0 if ($leni and length $t > $leni and not $ops->{'-truncate'} =~ /no/io) { }
635 0 0 $ops->{'-truncate'} =~ /er/io ? :
640 0 0 unless $ops->{'-suffix'} =~ /no/io
641 0 0 wantarray ? :
648 1 0 if ($t =~ /^\d{8}(?: \d{4,6})?$/o) { }
658 0 1 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
659 0 0 $ops->{'-truncate'} =~ /er/io ? :
662 1 0 unless $ops->{'-suffix'} =~ /no/io
663 0 1 wantarray ? :
667 0 0 wantarray ? :
671 0 1 $pic =~ s/([^$regexDelimiter]+)$// ? :
672 0 1 $suffix =~ s/^(\w+)\;// ? :
675 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
676 0 0 $ops->{'-truncate'} =~ /er/io ? :
678 1 0 unless $ops->{'-suffix'} =~ /no/io
679 0 1 wantarray ? :
681 1 0 $pic =~ s/\)([^\)]*)$/)/ ? :
687 0 1 if ($v =~ /^\d+$/o) { }
700 1 0 unless $pic =~ /^\w+\:\:/o
702 0 1 unless $pic =~ /\(.*\)/o
704 0 1 if $@
705 0 0 if ($leni and length $t > $leni and not $ops->{'-truncate'} =~ /no/io)
706 0 0 $ops->{'-truncate'} =~ /er/io ? :
708 1 0 unless $ops->{'-suffix'} =~ /no/io
709 0 1 wantarray ? :
712 0 3 if ($pic =~ /^\*(.*)$/)
715 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
716 0 0 $ops->{'-truncate'} =~ /er/io ? :
718 0 0 unless $ops->{'-suffix'} =~ /no/io
719 0 0 wantarray ? :
721 2 1 $pic =~ s/([^\<\|\>\.\^]+)$//o ? :
726 3 4 if ($special eq ',') { }
727 3 0 unless $ops->{'-nonnumeric'}
732 0 3 $float =~ /\+\$/o ? :
733 1 2 if ($float =~ /\(/o)
735 0 1 unless $suffix =~ /^\)/o
737 2 1 if ($v < 0) { }
740 2 0 unless $fixedLeni or $leniSpecified
744 1 0 unless $fixedLeni or $leniSpecified
746 0 1 if not $fixedLeni || $leniSpecified and $float =~ s/\(//o
752 3 0 if $two > 0
757 0 0 $commatize || $float =~ /\$/o || $pic =~ /[\.\,\^\$]/o ? :
759 3 0 unless ($fixedLeni or $leniSpecified)
767 3 0 if ($decPic and not $ops->{'-nonnumeric'}) { }
772 3 0 if $decPic =~ /([\<\|\>])$/o
774 0 0 unless ($pic =~ /\./o or $v =~ /\./)
775 0 0 if $v =~ /^[\+\-\d\. ]+$/o
778 3 0 unless ($float =~ /\+/o)
779 2 1 if $v >= 0 or $suffix =~ /^[\_ ]*CR\s*$/io
783 0 0 if $float =~ s/.(\(?)$/$1/
786 3 0 if ($decJustify eq '>')
792 0 3 if $decLeni < 0
798 0 0 unless ($ops->{'-nonnumeric'})
808 3 0 unless ($ops->{'-nonnumeric'})
810 1 2 if ($v >= 0) { }
816 1 1 if $suffix =~ s/^([\_ ]*)(CR\s*)$/' ' x length($1) . $2;/ie
819 1 2 if $float =~ /[\(\-]/o
824 4 0 unless (not $ops->{'-nonnumeric'} and $t2 eq '(' and $v >= 0)
829 0 0 if $l == $leni and $v < 0 and $float =~ s/\(//o and not $ops->{'-nonnumeric'}
830 3 0 if ($commatize)
832 3 0 if ($decJustify eq '>')
839 6 0 unless $fixedLeni or $leniSpecified
842 0 3 if $switchFloat
843 0 3 if ($ops->{'-truncate'} =~ /er/io and length $t > $leni) { }
3 0 elsif (not $ops->{'-truncate'} =~ /no/io or length $t <= $leni) { }
846 0 3 if not $fixedLeni || $leniSpecified and $float =~ /\(/o
847 0 3 if ($justify eq '|') { }
0 3 elsif ($justify eq '<') { }
850 0 0 wantarray ? :
857 0 0 if not $fixedLeni || $leniSpecified and $float =~ /\(/o
860 2 1 unless $v =~ /\(/o
861 3 0 unless $ops->{'-suffix'} =~ /no/io
862 0 3 wantarray ? :
865 0 1 if $fixedLeni
868 0 1 $pic =~ s/([^wW<|>\d]+)$//o ? :
869 0 1 if $pic =~ /w/o
870 1 0 if $pic =~ /^.*([<|>])/o
873 1 0 unless $fixedLeni
876 0 1 if (length $pic)
877 0 0 !($ops->{'-suffix'} =~ /no/io) ? :
881 1 0 if ($wrapchar eq 'W')
887 0 1 if ($@) { }
891 0 1 if ($justify eq '>') { }
0 1 elsif ($justify eq '|') { }
894 0 0 unless ($ops->{'-suffix'} =~ /no/io)
895 0 0 !$i || $ops->{'-suffix'} =~ /all/io ? :
905 0 0 unless ($ops->{'-suffix'} =~ /no/io)
906 0 0 !$i || $ops->{'-suffix'} =~ /all/io ? :
916 4 0 unless ($ops->{'-suffix'} =~ /no/io)
917 1 3 !$i || $ops->{'-suffix'} =~ /all/io ? :
923 0 1 wantarray ? :
926 0 0 if ($wrapchar eq 'w')
934 0 0 unless ($ops->{'-suffix'} =~ /no/io)
935 0 0 !$j || $ops->{'-suffix'} =~ /all/io ? :
940 0 0 if ($justify eq '>') { }
0 0 elsif ($justify eq '|') { }
949 0 0 wantarray ? :
952 0 0 if $fixedLeni
953 0 0 $pic =~ s/^\$//o ? :
954 0 0 $pic =~ s/^\,//o ? :
955 0 0 $pic =~ s/^(\-?[\d\.]+\w)(.*)$/$1/o ? :
956 0 0 $pic =~ /^\-?(\d+)/ ? :
0 0 unless $fixedLeni
957 0 0 $pic =~ /^\-/o ? :
958 0 0 $lj eq '-' ? :
961 0 0 $pic =~ /\.(\d+)/o ? :
962 0 0 if ($float)
964 0 0 if $pic =~ s/^\%\-/%/o
965 0 0 unless ($fixedLeni)
966 0 0 if $pic =~ /^\%(\d+)/o
971 0 0 if ($commatize) { }
972 0 0 unless ($fixedLeni)
973 0 0 if $pic =~ /^\%(\d+)/o
979 0 0 if ($l > $leni)
981 0 0 wantarray ? :
987 0 0 unless $float
990 0 0 if $float and $l < $leni
992 0 0 unless $ops->{'-suffix'} =~ /no/io
993 0 0 wantarray ? :
1007 0 1 $ops->{'-bad'} ? :
1008 0 1 $pic =~ /^.*?([<|>])/o ? :
1009 0 1 $$ops{-'sizefixed'} ? :
1010 1 0 if ($pic =~ s/^\@//o) { }
0 0 elsif ($pic =~ s/^\=//o) { }
0 0 elsif ($pic =~ s/^\%//o) { }
1011 0 1 if $fixedLeni
1012 0 1 if $pic =~ s/^(\d+)\://o
1014 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) { }
1016 1 0 if $pic =~ s/\Q$regexDelimiter\E(.*)$//
1035 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
1036 0 0 $ops->{'-truncate'} =~ /er/io ? :
1038 0 1 wantarray ? :
1040 0 0 unless $haveFmtstr2time
1042 0 0 $pic =~ s/\^([^\^]*)$// ? :
1045 0 0 if $pic =~ /\^/
1047 0 0 if $ops->{'-outfmt'}
1048 0 0 unless $ops->{'-suffix'} =~ /no/io
1050 0 0 if ($haveFmtstr2time)
1052 0 0 if ($t and $outpic)
1053 0 0 unless $haveTime2fmtstr
1054 0 0 $haveTime2fmtstr ? :
1057 0 0 unless ($t)
1058 0 0 if ($outpic and not $outpic =~ /^yyyymmdd(?:hhmm(?:ss)?)?$/i)
1060 0 0 wantarray ? :
1069 0 0 if index($pic, $i) > 0
1073 0 0 if ($leni and length $t > $leni and not $ops->{'-truncate'} =~ /no/io)
1074 0 0 $ops->{'-truncate'} =~ /er/io ? :
1076 0 0 wantarray ? :
1079 0 0 if $pic =~ s/\Q$regexDelimiter\E(.*)$//
1082 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
1083 0 0 $ops->{'-truncate'} =~ /er/io ? :
1085 0 0 wantarray ? :
1087 0 0 if $pic =~ s/\\\;(.*)$//
1091 0 0 if ($v =~ /^\d+$/o) { }
1102 0 0 unless $pic =~ /^\w+\:\:/o
1104 0 0 unless $pic =~ /\(.*\)/o
1106 0 0 if $@
1108 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
1109 0 0 $ops->{'-truncate'} =~ /er/io ? :
1111 0 0 wantarray ? :
1113 0 0 if ($pic =~ /^\*(.*)$/)
1116 0 0 if ($leni and length $v > $leni and not $ops->{'-truncate'} =~ /no/io)
1117 0 0 $ops->{'-truncate'} =~ /er/io ? :
1119 0 0 unless $ops->{'-suffix'} =~ /no/io
1120 0 0 wantarray ? :
1122 0 0 if $pic =~ s/([^<|>.]+)$//o
1129 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) { }
1134 0 0 unless ($$ops{-'nonnumeric'})
1138 0 0 if $special
1141 0 0 unless $ops->{'-suffix'} =~ /no/io
1143 0 0 if ($isneg)
1144 0 0 unless $v =~ /^\-/o
1150 0 0 if $two > 0
1153 0 0 $pic =~ /^.*?([<|>])/o ? :
1155 0 0 if ($pic =~ /^([<|>]+)[\.\^]([<|>]+)/o) { }
0 0 elsif ($pic =~ /^([\[\<\|\>]+)/o) { }
1158 0 0 unless ($ops->{'-nonnumeric'})
1160 0 0 $two =~ /([\<\|\>])$/o ? :
1161 0 0 if (not $pic =~ /\./o and $v =~ /\./ and $v =~ /^[\+\-\d\. ]+$/o) { }
1162 0 0 if $v =~ /^[\+\-\d\. ]+$/o
1172 0 0 if $leniSpecified and $leni > $leniSpecified
1173 0 0 if ($leni and length $v > $leni)
1174 0 0 if ($decJustify eq '>' and not $ops->{'-nonnumeric'} and $v =~ /^[0-9\+\-]*\.[0-9]+/o)
1177 0 0 unless $v =~ /\./o
1179 0 0 unless length $v
1182 0 0 if ($leni and length $v > $leni)
1183 0 0 unless ($ops->{'-truncate'} =~ /no/io)
1184 0 0 if ($ops->{'-truncate'} =~ /er/io) { }
1187 0 0 if ($justify eq '>') { }
1200 0 0 if ($padcnt > 0)
1201 0 0 if ($justify eq '>') { }
0 0 elsif ($justify eq '|') { }
1205 0 0 $i % 2 ? :
1211 0 0 wantarray ? :
1216 0 0 $pic =~ s/([^wW<|>\d]+)$//o ? :
1217 0 0 if $pic =~ /w/o
1218 0 0 if $pic =~ /^.*([<|>])/o
1220 0 0 if ($justify eq '<') { }
0 0 elsif ($justify eq '>') { }
1228 0 0 if $leni > $leniSpecified
1229 0 0 if ($leni and length $v > $leni) { }
0 0 elsif ($leniSpecified and length $v < $leniSpecified) { }
1230 0 0 unless ($ops->{'-truncate'} =~ /no/io)
1231 0 0 $ops->{'-truncate'} =~ /er/io ? :
1235 0 0 if ($padcnt > 0)
1236 0 0 $justify eq '>' ? :
1239 0 0 wantarray ? :
1241 0 0 $pic =~ s/^\$//o ? :
1242 0 0 $pic =~ s/^\,//o ? :
1243 0 0 if $pic =~ s/^(\-?[\d\.]+\w)(.*)$/$1/o
1244 0 0 $pic =~ /^\-?(\d+)/ ? :
1245 0 0 $pic =~ /^\-/o ? :
1246 0 0 $lj eq '-' ? :
1249 0 0 $pic =~ /\.(\d+)/o ? :
1250 0 0 if ($float)
1252 0 0 if $pic =~ s/^\%\-/%/o
1253 0 0 if $pic =~ /^\%(\d+)/o
1257 0 0 if ($commatize) { }
1258 0 0 if $pic =~ /^\%(\d+)/o
1263 0 0 if ($l > $leni)
1265 0 0 wantarray ? :
1276 0 0 if $float and $l < $leni
1278 0 0 wantarray ? :
1289 1 0 if ($pic =~ s/^\@//o) { }
0 0 elsif ($pic =~ s/^\=//o) { }
0 0 elsif ($pic =~ s/^\%//o) { }
1290 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) { }
1311 0 1 if $pic =~ /^\*(.*)$/o
1317 1 1 if ($special eq ',') { }
1328 1 0 if $two > 0
1340 0 0 if $pic =~ s/([^wW<|>\d]+)$//o
1341 0 0 if $pic =~ /w/o
1342 0 0 if $pic =~ /^.*([<|>])/o
1347 0 0 $pic =~ s/^\$//o ? :
1348 0 0 $pic =~ s/^\,//o ? :
1349 0 0 $pic =~ s/^(\-?[\d\.]+\w)(.*$)/$1/o ? :
1350 0 0 $pic =~ /^\-?(\d+)/ ? :
1351 0 0 $pic =~ /^\-/o ? :
1354 0 0 if ($float)
1356 0 0 if $pic =~ /^\%(\d+)/o
1358 0 0 if ($commatize)
1359 0 0 if $pic =~ /^\%(\d+)/o
1373 0 0 if ($pic =~ s/^\@//o) { }
0 0 elsif ($pic =~ s/^\=//o) { }
0 0 elsif ($pic =~ s/^\%//o) { }
1375 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) { }
1384 0 0 if $pic =~ /^\*(.*)$/
1385 0 0 if $pic =~ s/([^\<\|\>\.\^]+)$//o
1390 0 0 if ($special eq ',') { }
1396 0 0 if ($float =~ /\(/o)
1398 0 0 unless $suffix =~ s/^\)//o
1400 0 0 if ($v < 0) { }
1409 0 0 $pic =~ /^.*?([<|>])/o ? :
1412 0 0 $commatize || $float =~ /\$/o || $pic =~ /[.,\$]/o ? :
1418 0 0 if $pic =~ s/([^wW<|>\d]+)$//o
1419 0 0 if $pic =~ /w/o
1420 0 0 if $pic =~ /^.*([<|>])/o
1423 0 0 $pic =~ s/^\$//o ? :
1424 0 0 $pic =~ s/^\,//o ? :
1425 0 0 $pic =~ s/^(\-?[\d\.]+\w)(.*$)/$1/o ? :
1426 0 0 $pic =~ /^\-?(\d+)/ ? :
1427 0 0 $pic =~ /^\-/o ? :
1442 0 0 if ($pic =~ s/^\@//o) { }
0 0 elsif ($pic =~ s/^\=//o) { }
0 0 elsif ($pic =~ s/^\%//o) { }
1444 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) { }
1446 0 0 if $pic =~ s/\Q$regexDelimiter\E(.*)$//
1450 0 0 $pic =~ s/\^([^\^]*)$// ? :
1455 0 0 if $pic =~ s/([^$regexDelimiter]+)$//
1458 0 0 if $pic =~ s/\)([^\)]*)$/)/o
1461 0 0 if $pic =~ /^\*(.*)$/
1462 0 0 if $pic =~ s/([^<|>.]+)$//o
1468 0 0 if $pic =~ s/([^wW<|>\d]+)$//o
1473 0 0 $pic =~ s/^(\-?[\d\.]+\w)(.*)$/$1/o ? :
1488 0 0 wantarray ? :
0 1 unless $dt =~ /\S/o
1489 0 1 if $dt =~ /\d{9,14}\D*$/o
1490 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) { }
1493 0 1 if ($1 < 1000 and $3 < 1000) { }
1 0 elsif ($1 > 1000) { }
1495 0 0 $3 < 80 ? :
1507 1 0 if ($dt =~ s/^\D+(\d\d?)\:?(\d\d?)//o) { }
1510 1 0 $dt =~ s/\:?(\d\d?)//o ? :
1511 1 0 if ($dt =~ /(\s*[ap]m?)/i)
1514 1 0 if $x =~ /\d (\d\d)/
1515 0 1 if ($indicator =~ /a/i and $hr == 12) { }
1 0 elsif ($indicator =~ /p/i and $hr != 12) { }
1542 0 1 unless $then > 0
1543 1 0 wantarray ? :
1548 0 0 if (length $dt == 6) { }
1550 0 0 substr($dt, 0, 2) < 80 ? :
1556 0 0 if ($leftpart < 1300)
1563 0 0 if ($timepart =~ s/^(\d\d)(\d\d)//o or $timepart =~ s/^(\d\d?)\:(\d\d?)\:?//o) { }
1566 0 0 $timepart =~ s/(\d\d?)\s*//o ? :
1567 0 0 if ($timepart =~ /([ap]m?)/io)
1570 0 0 if $dt =~ /\d (\d\d)/
1571 0 0 if ($indicator =~ /a/i and $hr == 12) { }
0 0 elsif ($indicator =~ /p/i and $hr != 12) { }
1593 0 0 unless $then > 0
1594 0 0 wantarray ? :
1598 0 0 wantarray ? :