Branch Coverage

blib/lib/Net/LDAP/LDIF.pm
Criterion Covered Total %
branch 124 222 55.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+(?i)(true|false))?(?:\s*:([:<])?\s*(.*))?$/) { }
244 4 0 $critical && $critical =~ /true/i ? :
246 2 2 if (defined $value)
247 1 1 if ($type)
249 0 1 unless defined $value
261 0 4 unless @ldif
270 6 8 if (scalar @ldif and $ldif[0] =~ /^changetype:\s*/) { }
272 6 0 $ldif[0] =~ s/^changetype:\s*// ? :
275 0 6 if ($changetype eq 'delete')
276 0 0 if @ldif
278 0 0 wantarray ? :
281 0 6 unless @ldif
290 0 6 if ($changetype eq 'modify')
291 0 0 unless ((my $tmp = shift @ldif) =~ s/^(add|delete|replace|increment):\s*([-;\w]+)//)
301 0 60 if ($line eq '-')
302 0 0 unless defined $modattr and defined $lastattr
308 60 0 if ($line =~ /^([-;\w]+):([\<\:]?)\s*(.*)$/o) { }
311 0 60 if defined $modattr and $attr ne $modattr
314 0 60 if $xattr
316 0 60 unless defined $val
319 0 60 if $self->{'raw'} and not $attr =~ /$self->{'raw'}/
321 30 30 if (not defined $lastattr or $lastattr ne $attr)
322 24 6 if defined $lastattr
334 6 0 if defined $lastattr
343 0 8 if @controls
347 888 0 if ($line =~ /^([-;\w]+):([\<\:]?)\s*(.*)$/o) { }
350 8 880 unless $last
352 0 888 if $xattr
354 0 888 unless defined $val
357 0 888 if $self->{'raw'} and not $attr =~ /$self->{'raw'}/
359 32 856 if ($attr ne $last)
375 6 8 wantarray ? :
382 0 16 unless $self->{'fh'}
392 2 1 unless wantarray
404 4 19 if $eof
412 271 41 if length $_[0] <= $len or $len <= 40
416 0 41 length $_[0] == $l2 * $x + $len ? :
427 0 284 $lower ? :
429 0 284 if &Encode::is_utf8($v)
432 0 284 if ($v =~ /(^[ :<]|[\x00-\x1f\x7f-\xff]| $)/) { }
446 0 0 $b =~ /^objectclass$/io ? :
0 0 $a =~ /^objectclass$/io ? :
455 0 22 if $self->{'sort'}
472 4 0 $ctrl->critical ? :
475 2 2 if (defined $v)
476 0 2 if &Encode::is_utf8($v)
479 1 1 if ($v =~ /(^[ :<]|[\x00-\x1f\x7f-\xff]| $)/)
497 0 24 if &Encode::is_utf8($dn)
500 0 24 if ($dn =~ /^[ :<]|[\x00-\x1f\x7f-\xff]/) { }
501 0 0 if ($encode =~ /canonical/i) { }
0 0 elsif ($encode =~ /base64/i) { }
543 1 7 if $self->{'version'} and not $self->{'version_written'}++
556 0 9 unless $self->{'fh'}
562 27 3 if (ref $elem) { }
0 3 elsif (not @args) { }
563 15 12 if (scalar(@args) % 2)
578 9 0 if (scalar(@args) % 2) { }
0 0 elsif (@args) { }
586 0 0 if not $res and $!
602 9 15 if ($change) { }
607 0 9 if $type eq 'modify' and not @changes
609 3 6 unless $self->{'write_count'}++
616 3 0 ref $opt{'control'} eq 'ARRAY' ? :
3 6 if $opt{'control'}
620 0 9 if ($type eq 'delete') { }
7 2 elsif ($type eq 'add') { }
0 2 elsif ($type =~ /modr?dn/o) { }
632 0 0 if defined $ns
642 10 2 if not $self->{'version'} and $dash++
645 0 12 if $self->{'version'}
650 5 10 unless $self->{'write_count'}++
664 0 0 unless wantarray
688 12 3 if ($self->{'fh'})
689 8 4 if ($self->{'opened_fh'})
729 0 0 if $self->{'onerror'}
763 1 0 unless @_