Branch Coverage

blib/lib/Business/EDI.pm
Criterion Covered Total %
branch 214 440 48.6


line true false branch
29 0 30909 unless my $class = ref $self
33 17582 137 unless $name =~ /^syntax/ or $name =~ /^SG\d+$/ or $name =~ s/^s(eg(ment)?)?//i
38 0 30909 if $debug
40 30792 117 if (exists $$self{'_permitted'}{$name})
41 0 30792 if (@_) { }
48 1 116 if (ref $$self{'def'} eq 'ARRAY')
49 1 0 if ($name =~ s/^all_(.+)$/$1/i)
50 0 1 if @_
51 0 1 if ($debug)
54 0 0 if $debug > 1
56 1 0 $name =~ /^SG\d+$/ ? :
57 29 0 if $$_{'code'}
67 0 670 unless my $self = shift()
68 0 670 unless my $name = shift()
69 0 670 unless ($$self{'def'})
81 232 438 if $name =~ /^SG\d+$/
82 0 670 if $debug
83 0 670 if $debug
90 670 0 if ($total_possible == 1 or $hitcount == 1 and not @_) { }
0 0 elsif ($total_possible == 0) { }
92 1888 670 unless $_->code eq $name
93 0 670 if (@_) { }
104 0 0 if $debug and $debug > 1
106 0 0 @_ ? :
112 0 1172 unless my $self = shift()
113 0 1172 unless my $name = shift()
114 0 1172 unless $$self{'_permitted'}
120 0 1172 if $debug
123 0 1172 if (scalar @hits) { }
1172 0 elsif ($ccount) { }
126 0 1172 unless my $spec = $self->spec
129 0 1182 unless $$part{$code}
131 1172 10 if @subparts
136 0 1172 if $debug
137 1172 0 if ($hitcount == 1) { }
0 0 elsif ($hitcount > 1) { }
138 0 1172 if (@_) { }
148 0 0 if $debug and $debug > 1
158 8 47 if (scalar @_ eq 1) { }
46 1 elsif (@_) { }
161 0 46 if scalar(@_) % 2
166 54 0 if $_ eq 'version'
167 0 0 unless exists $$stuff{'_permitted'}{$_}
170 54 1 if ($args{'version'})
171 0 54 unless $self->spec('version', $args{'version'})
173 0 55 if $debug and $debug > 1
181 0 1843 unless my $type = shift()
182 0 1843 unless my $spec = $self->spec
184 0 1843 unless my $code = uc shift()
187 0 1843 unless $$part{$code}
190 0 1843 unless (ref $body eq 'HASH')
199 0 4948 if /^SG\d+$/ and push @seggroups, $_
200 2366 2582 if /^C\d{3}$/ and push @compcodes, $_
202 1792 51 if @compcodes
208 2940 12 if (grep {$key eq $_;} @subparts) { }
12 0 elsif (@compcodes) { }
217 12 0 if (scalar @hits == 1) { }
0 0 elsif (scalar @hits > 1) { }
229 0 1843 if $debug
232 0 1843 unless $unblessed
241 0 1264 unless (defined $new->part($_))
250 0 864 unless my $type = shift()
251 0 864 unless my $spec = $self->spec
253 0 864 unless my $code = uc shift()
255 772 92 @_ && $_[0] ? :
258 19 845 if ($type eq 'message') { }
845 0 elsif ($type eq 'segment_group') { }
262 0 845 if $code =~ /^SG\d+$/ and $message_code
263 0 845 unless $code =~ m[^(\S+)/(SG\d+)$]
264 0 845 unless $page = $$page{$1}
270 0 864 unless (ref $body eq 'ARRAY')
275 0 864 if $debug
276 0 864 if $debug
278 0 864 unless $unblessed
287 845 19 if ($type eq 'segment_group')
345 0 1728 unless my $spec = $self->spec
346 0 1728 unless @_
352 0 122 unless @_
360 0 2562 if @_
366 2887 5797 if (@_)
367 3 2884 unless ref $self
368 2765 119 if (ref $_[0] eq 'Business::EDI::Spec') { }
374 0 8681 unless ref $self
382 0 0 unless $msg
383 0 0 if $debug or not $quiet
390 0 0 if (@_) { }
395 0 0 if (ref $obj_or_message)
408 0 3816 unless $body
409 0 3816 unless $codesref
410 0 3816 unless (ref $body eq 'HASH')
413 0 3816 unless (ref $codesref eq 'ARRAY')
416 0 3816 if $debug
420 5908 6912 unless $$body{$_}
433 864 0 @_ && $_[0] ? :
436 0 864 unless $body
437 0 864 unless $codesref
438 0 864 unless (ref $body eq 'ARRAY')
441 0 864 unless (ref $codesref eq 'ARRAY')
444 0 864 if $debug
451 0 864 unless my $sg_specs = $class->spec_page('segment_group')
452 0 864 unless my $msg_sg_specs = $$sg_specs{$msg}
458 0 864 if (@$body == 2 and ref $$body[0] eq '')
467 0 3982 unless (ref $bodypart eq 'ARRAY')
473 0 3982 if $debug
476 0 0 $key eq $$def{'code'} ? :
0 7559 if $debug
477 2496 5063 if ($key eq $$def{'code'})
480 2496 0 if (++$repeats <= $limit) { }
483 0 0 if $strict
489 186 271 if ($$def{'mandatory'} and not $$def{'code'} =~ /^UN.$/ and not $repeats)
491 0 186 if $strict
492 0 186 if $debug
498 1486 0 if ($j >= $codecount)
500 0 1486 if $strict
501 0 1486 if $debug
508 0 0 if $$codesref[$j]{'mandatory'}
515 1724 772 if ($key =~ /^[A-Z]{3}$/) { }
516 0 1724 if $debug
527 0 6416 unless my $class = ref $self
528 0 6416 unless my $name = shift()
530 3013 3403 unless (exists $$self{'_permitted'}{$name})
531 1957 1056 if ($$self{'def'})
532 1287 670 if ($name =~ s/^all_(.+)$/$1/i)
533 0 1287 if @_
534 0 1287 if ($debug)
537 0 0 if $debug > 1
539 585 702 $name =~ /^SG\d+$/ ? :
540 12169 0 if $$_{'code'}
547 0 3403 if (@_) { }
559 0 1346 if ($$self{'def'})
560 0 0 $$_{'repeats'} > 1 ? :
583 772 7111 @_ && $_[0] ? :
584 0 7883 unless ($body)
588 193 7690 unless (ref $body)
589 0 193 if $debug
592 0 7690 if ref($body) =~ /^Business::EDI/
594 0 7690 if (ref $body eq 'ARRAY') { }
0 7690 elsif (ref $body ne 'HASH') { }
595 0 0 if (scalar @$body != 2) { }
606 0 7690 if $debug
610 0 7690 if $debug
612 2944 4746 if ($$codelist_map{$_}) { }
1904 2842 elsif (/^C\d{3}$/ or /^S\d{3}$/) { }
0 2842 elsif (/^[A-Z]{3}$/) { }
772 2070 elsif (m[^(\S+/)?(SG\d+)$]) { }
193 1877 elsif ($ref eq 'ARRAY') { }
0 1877 elsif ($ref) { }
613 0 2944 unless $$new{$_} = $self->codelist($_, $$body{$_})
616 0 1904 unless $$new{$_} = 'Business::EDI::Composite'->new({$_, $$body{$_}})
619 0 0 unless $$new{$_} = $self->segment($_, $$body{$_})
626 0 772 $msg ? :
0 772 unless $$new{$sg_spec} = $self->segment_group($msg ? $sg_spec : "$message_code/$sg_tag", $$body{$_}, $message_code)
630 0 193 unless $count == 1
632 0 193 unless $$new{$_} = $self->subelement($$body{$_}[0], $message_code)
635 0 0 unless $$new{$_} = $self->subelement($$body{$_}, $message_code)
641 7690 0 if scalar keys %$body == 1
650 0 4137 unless my $path = shift()
651 0 4137 unless my $class = ref $self
652 0 4137 if $path eq '/'
653 0 4137 if $path =~ m[([^-A-z_0-9/\.])]
654 0 4137 if $path =~ m[(//)]
655 0 4137 if $path =~ m[^/]
658 0 4137 unless defined $front
659 2462 1675 unless defined $back
660 0 4137 if $debug
662 4137 0 if ($front)
663 2462 1675 unless $back
665 0 1675 unless push @ret, $self->part($front)
674 0 17 unless @hits
675 15 2 unless wantarray
683 0 0 @_ ? :
684 0 0 @_ ? :
685 0 0 unless my $obtype = ref $self
689 0 0 unless $obtype =~ s/^Business::EDI:://
690 0 0 if ($obtype =~ /::(.*)$/)
699 0 0 if eval { do { $self->$_ } }
703 0 0 unless defined $tophash{$_}
705 0 0 if $_ eq 'label'
709 0 0 if $_ ne 'label' and $_ ne 'value' and $_ ne 'code'
711 0 0 $$self{'array'} ? :
712 0 0 if $debug
714 0 0 ref $_ ? :
0 0 if $debug
715 0 0 if (@parts)
718 0 0 unless ref $_ and $$_{'code'}
719 0 0 if $debug
741 0 0 unless my $self = shift()
742 0 0 if @_
747 0 0 unless my $self = shift()
758 0 1836 unless my $class = ref $self
759 0 1836 unless my $name = shift()
760 0 1836 unless my $code = $$self{'message_code'}
761 0 1836 unless my $spec = $$self{'spec'}
764 500 1336 if ($sg) { }
765 0 500 if $debug
766 500 0 if ($sg =~ m[/]) { }
771 0 500 unless $first eq $$self{'sg_code'}
773 0 0 $obj ? :
774 0 0 unless $obj
775 0 0 unless $obj
777 0 500 $obj ? :
782 0 1336 if $debug
802 0 121 unless my $class = ref $self
803 0 121 unless my $name = shift()
804 0 121 unless my $code = $$self{'message_code'}
805 0 121 unless my $spec = $$self{'spec'}
807 53 68 if ($sg) { }
809 0 53 if $debug
812 0 68 if $debug
829 0 7 unless my $body = shift()
830 0 7 unless ref $body eq 'ARRAY'
833 0 7 unless ($tag)
834 0 7 unless ($segbody)
835 0 7 if (scalar @xtra)
836 0 7 unless $tag eq 'UNH'
842 0 7 unless $agency and $agency eq 'UN'
843 0 7 unless $pre and uc $pre eq 'D'
844 0 7 unless $release
846 0 0 if @_ and $_[0]
847 0 7 unless my $edi = 'Business::EDI'->new('version', "$pre$release")