Branch Coverage

blib/lib/Net/LDAP/LDIF.pm
Criterion Covered Total %
branch 125 220 56.8


line true false branch
25 12 0 @_ % 2 ? :
32 12 0 if defined $modes{$mode}
34 4 8 if (ref $file) { }
38 0 8 if ($file eq '-') { }
39 0 0 $mode eq '<' ? :
43 0 0 if ($mode =~ /(:.*$)/)
49 0 8 $file =~ /^\| | \|$/x ? :
52 0 8 unless $opened_fh
57 12 0 unless exists $opt{'encode'}
60 12 0 unless exists $opt{'onerror'}
68 0 12 $mode =~ /^\s*\+?>>/ && tell $fh > 0 ? :
92 2 15 if $self->eof
96 0 1021 if ($ln =~ /^#/o) { }
100 25 996 if ($ln =~ /^[ \t]/o) { }
101 25 0 unless $in_comment
105 12 984 if ($ln =~ /^\r?\n$/o) { }
108 11 1 if length $entry
111 11 973 if ($entry_completed) { }
123 4 11 unless defined $ln
141 0 0 if ($url =~ s[^file:(?://)?][]) { }
0 0 elsif ($url =~ /^(https?|ftp|gopher|news:)/ and eval { do { require LWP::UserAgent } }) { }
142 0 0 unless open my $fh, '<', $url
157 0 0 unless $response->is_success
162 0 0 unless defined $line
181 1 14 if ($type and $type eq ':') { }
0 14 elsif ($type and $type eq '<' and $value =~ s/^(.*?)\s*$/$1/) { }
188 0 0 unless defined $value
206 2 15 unless (@ldif)
207 0 2 unless $self->eof
211 1 14 if (@ldif and $ldif[0] =~ /^version:\s+(\d+)/)
214 1 0 unless @ldif
218 0 14 if (@ldif < 1) { }
0 14 elsif (not $ldif[0] =~ /^dn::? */) { }
226 14 0 if $dn =~ s/^dn:(:?) *//
232 0 14 if $self->{'raw'} and not 'dn' =~ /$self->{'raw'}/
241 4 0 if ($control =~ /^control:\s*(\d+(?:\.\d+)*)(?:\s+(true|false))?(?:\s*\:(.*))?$/) { }
244 4 0 $critical && $critical =~ /true/ ? :
246 2 2 if (defined $value)
247 1 1 if $value =~ s/^([\<\:])\s*//
251 1 1 if ($type)
253 0 1 unless defined $value
265 0 4 unless @ldif
274 6 8 if (scalar @ldif and $ldif[0] =~ /^changetype:\s*/) { }
276 6 0 $ldif[0] =~ s/^changetype:\s*// ? :
279 0 6 if ($changetype eq 'delete')
280 0 0 if @ldif
285 0 6 unless @ldif
294 0 6 if ($changetype eq 'modify')
295 0 0 unless ((my $tmp = shift @ldif) =~ s/^(add|delete|replace|increment):\s*([-;\w]+)//)
305 0 60 if ($line eq '-')
306 0 0 unless defined $modattr and defined $lastattr
312 60 0 if ($line =~ /^([-;\w]+):([\<\:]?)\s*(.*)$/o) { }
315 0 60 if defined $modattr and $attr ne $modattr
318 0 60 if $xattr
320 0 60 unless defined $val
323 0 60 if $self->{'raw'} and not $attr =~ /$self->{'raw'}/
325 30 30 if (not defined $lastattr or $lastattr ne $attr)
326 24 6 if defined $lastattr
338 6 0 if defined $lastattr
347 0 8 if @controls
351 888 0 if ($line =~ /^([-;\w]+):([\<\:]?)\s*(.*)$/o) { }
354 8 880 unless $last
356 0 888 if $xattr
358 0 888 unless defined $val
361 0 888 if $self->{'raw'} and not $attr =~ /$self->{'raw'}/
363 32 856 if ($attr ne $last)
386 0 16 unless $self->{'fh'}
396 2 1 unless wantarray
408 4 19 if $eof
416 271 41 if length $_[0] <= $len or $len <= 40
420 0 41 length $_[0] == $l2 * $x + $len ? :
431 0 284 $lower ? :
433 0 284 if &Encode::is_utf8($v)
436 0 284 if ($v =~ /(^[ :<]|[\x00-\x1f\x7f-\xff]| $)/) { }
450 0 0 $b =~ /^objectclass$/io ? :
0 0 $a =~ /^objectclass$/io ? :
459 0 22 if $self->{'sort'}
476 4 0 $ctrl->critical ? :
479 2 2 if (defined $v)
480 0 2 if &Encode::is_utf8($v)
483 1 1 if ($v =~ /(^[ :<]|[\x00-\x1f\x7f-\xff]| $)/)
501 0 24 if &Encode::is_utf8($dn)
504 0 24 if ($dn =~ /^[ :<]|[\x00-\x1f\x7f-\xff]/) { }
505 0 0 if ($encode =~ /canonical/i) { }
0 0 elsif ($encode =~ /base64/i) { }
547 1 7 if $self->{'version'} and not $self->{'version_written'}++
560 0 9 unless $self->{'fh'}
566 27 3 if (ref $elem) { }
0 3 elsif (not @args) { }
567 15 12 if (scalar(@args) % 2)
582 9 0 if (scalar(@args) % 2) { }
0 0 elsif (@args) { }
590 0 0 if not $res and $!
606 9 15 if ($change) { }
611 0 9 if $type eq 'modify' and not @changes
613 3 6 unless $self->{'write_count'}++
620 2 1 ref $opt{'control'} eq 'ARRAY' ? :
3 6 if $opt{'control'}
624 0 9 if ($type eq 'delete') { }
7 2 elsif ($type eq 'add') { }
0 2 elsif ($type =~ /modr?dn/o) { }
636 0 0 if defined $ns
646 10 2 if not $self->{'version'} and $dash++
649 0 12 if $self->{'version'}
654 5 10 unless $self->{'write_count'}++
668 0 0 unless wantarray
692 12 3 if ($self->{'fh'})
693 8 4 if ($self->{'opened_fh'})
733 0 0 if $self->{'onerror'}
767 1 0 unless @_