Branch Coverage

blib/lib/Date/Reformat.pm
Criterion Covered Total %
branch 193 266 72.5


line true false branch
367 4 157 if (defined $$definition{'regex'})
370 3 1 if (defined $$definition{'params'})
386 10 147 if (defined $$definition{'strptime'})
394 132 15 if (defined $$definition{'heuristic'})
413 5 156 if (defined $$definition{'sprintf'})
422 8 148 if (defined $$definition{'strftime'})
430 6 142 if (defined $$definition{'structure'})
431 3 3 if ($$definition{'structure'} =~ /^hash(?:ref)?$/)
440 3 0 if ($$definition{'structure'} =~ /^array(?:ref)?$/)
450 1 141 if (defined $$definition{'coderef'})
509 0 3 unless @components
530 0 11 unless $success
534 0 2 if (defined $date{'hour_12'} and $date{'hour_12'} > 12 || $date{'hour_12'} == 0)
579 0 0 $$TOKENS{$1} ? :
595 10 0 if $$self{'debug'}
646 132 0 if $$self{'debug'}
648 0 132 unless @parts
654 343 0 if $$self{'debug'}
655 0 343 if ($part =~ /^$regex_for_time_zone_offset$/) { }
5 338 elsif ($part =~ /^$regex_for_time$/) { }
0 338 elsif ($part =~ /^$regex_for_time_zone_long_name$/) { }
67 271 elsif ($part =~ /^$regex_for_date$/) { }
3 268 elsif ($part =~ /^$regex_for_julian_day$/) { }
130 138 elsif ($part =~ /^$regex_for_number$/) { }
31 107 elsif ($part =~ /^$regex_for_string$/) { }
98 9 elsif ($part =~ /^$regex_for_whitespace$/) { }
656 0 0 if $$self{'debug'}
663 5 0 if $$self{'debug'}
667 5 0 if $$self{'debug'}
671 5 0 if (@time > 2)
672 5 0 if $$self{'debug'}
703 21 46 if ($date_parts[0] =~ /^$$TOKENS{'year'}{'regex'}$/ and scalar keys %$date == 0) { }
2 44 elsif ($hint eq 'dmy' and $date_parts[0] =~ /^$$TOKENS{'month_abbr'}{'regex'}$/ || $date_parts[0] =~ /^$$TOKENS{'month_name'}{'regex'}$/) { }
3 41 elsif ($hint eq 'mdy' and $date_parts[1] =~ /^$$TOKENS{'month_abbr'}{'regex'}$/ || $date_parts[1] =~ /^$$TOKENS{'month_name'}{'regex'}$/) { }
732 41 26 unless ($order_string =~ /^ymd|dmy|mdy$/)
733 41 0 if $$self{'debug'}
738 57 119 if ($order[$index] eq 'y') { }
59 60 elsif ($order[$index] eq 'm') { }
60 0 elsif ($order[$index] eq 'd') { }
739 34 23 if ($date_parts[$index] =~ /^$$TOKENS{'year'}{'regex'}$/) { }
20 3 elsif ($date_parts[$index] =~ /^$$TOKENS{'year_abbr'}{'regex'}$/) { }
740 34 0 if $$self{'debug'}
745 20 0 if $$self{'debug'}
757 42 17 if ($date_parts[$index] =~ /^$$TOKENS{'month'}{'regex'}$/ and $date_parts[$index] <= 12) { }
12 5 elsif ($date_parts[$index] =~ /^$$TOKENS{'month_abbr'}{'regex'}$/) { }
762 42 0 if $$self{'debug'}
767 12 0 if $$self{'debug'}
779 14 46 if (not $date_parts[$index] =~ /^$$TOKENS{'day'}{'regex'}$/ or $date_parts[$index] > 31)
789 46 0 if $$self{'debug'}
793 109 45 if $index < 2
803 4 126 if (length $part == 8) { }
4 122 elsif (length $part == 6) { }
3 119 elsif (length $part == 3 and defined $$date{'year'}) { }
29 90 elsif (length $part == 4) { }
819 1 3 if (defined $$date{'year'}) { }
854 3 0 if $$self{'debug'}
859 2 27 if (defined $$date{'year'} or defined $$date{'year_abbr'}) { }
869 2 2 unless ($$TOKENS{$token}{'constraint'}($hm{$token}))
888 0 27 unless defined $token
889 27 0 if $$self{'debug'}
892 15 0 unless (defined $$date{'day'} or defined $$date{'month'} or defined $$date{'month_abbr'} or defined $$date{'month_name'})
907 23 67 if (($order_string // $hint) eq 'dmy') { }
24 43 elsif (($order_string // $hint) eq 'mdy') { }
43 0 elsif (($order_string // $hint) eq 'ymd') { }
915 4 19 unless defined $token
916 19 0 if $$self{'debug'}
928 4 20 unless defined $token
929 20 0 if $$self{'debug'}
941 4 39 unless defined $token
942 39 0 if $$self{'debug'}
947 0 0 if $$self{'debug'}
960 29 2 if ($token) { }
961 24 5 if ($token eq 'month_name' or $token eq 'month_abbr')
962 6 18 if (defined $$date{'month'})
964 6 0 if (($order_string // $hint) =~ /md/)
965 6 0 if $$self{'debug'}
967 6 14 if ($parser_part =~ /\?/)
975 29 0 if $$self{'debug'}
980 2 0 if $$self{'debug'}
985 98 0 if $$self{'debug'}
989 9 0 if $$self{'debug'}
995 1 95 if (defined $$date{'am_or_pm'} and lc $$date{'am_or_pm'} eq 'pm')
996 1 0 if (defined $$date{'hour'} and $$date{'hour'} < 12)
999 1 12 if ($parser_part =~ /\?/)
1006 96 0 if $$self{'debug'}
1009 96 0 unless (defined $$known_parsers{$parser_regex})
1063 6 1 if $structure eq 'arrayref'
1092 3 0 if $structure eq 'hashref'
1190 52 0 if ($token =~ /%{(\w+)}/)
1195 52 0 if $$self{'debug'}
1198 2 50 if (defined $$TOKENS{$internal}{'storage'})
1210 8 0 if $$self{'debug'}
1227 68 0 if $$self{'debug'}
1228 0 68 if (defined $$self{'strptime_mappings'}{$token}) { }
65 3 elsif (defined $$DEFAULT_STRPTIME_MAPPINGS{$token}) { }
1235 3 65 unless (defined $internal)
1236 3 0 if $$self{'debug'}
1240 0 65 unless (defined $$TOKENS{$internal}{'regex'})
1243 65 0 if $$self{'debug'}
1255 52 0 if $$self{'debug'}
1256 0 52 if (defined $$self{'strftime_mappings'}{$token})
1259 0 52 if (defined $$self{'strptime_mappings'}{$token}) { }
0 52 elsif (defined $$DEFAULT_STRFTIME_MAPPINGS{$token}) { }
52 0 elsif (defined $$DEFAULT_STRPTIME_MAPPINGS{$token}) { }
1269 0 52 unless (defined $internal)
1270 0 0 if $$self{'debug'}
1274 0 52 unless (defined $$TOKENS{$internal}{'sprintf'})
1277 52 0 if $$self{'debug'}
1292 0 8 if defined $$date{$target_token}
1296 6 9 if (defined $$transformations{$target_token})
1298 6 0 if (defined $$date{$source_token} and defined $$transformations{$target_token}{$source_token})
1322 54 325 if ($token eq 'day')
1323 14 40 if defined $$already_claimed{'day'}
1324 0 40 unless $date_part =~ /^$$TOKENS{$token}{'regex'}$/
1325 8 32 if ($date_part > 31)
1333 66 259 if ($token eq 'month')
1334 18 48 if defined $$already_claimed{'month'}
1335 13 35 if defined $$already_claimed{'month_abbr'}
1336 5 30 if defined $$already_claimed{'month_name'}
1337 0 30 unless $date_part =~ /^$$TOKENS{$token}{'regex'}$/
1338 4 26 if ($date_part > 12)
1346 133 126 if ($token eq 'year' or $token eq 'year_abbr')
1347 36 97 if defined $$already_claimed{'year'}
1348 28 69 if defined $$already_claimed{'year_abbr'}
1349 22 47 unless $date_part =~ /^$$TOKENS{$token}{'regex'}$/
1354 0 126 if defined $$already_claimed{$token}
1355 97 29 unless $date_part =~ /^$$TOKENS{$token}{'regex'}$/
1359 0 2 if ($hint)
1376 242 0 $count ? :
1386 24 0 $count ? :
1398 110 36 if defined $date
1414 20 0 if scalar @formatted == 1
1426 5 0 if scalar @formatted == 1