Branch Coverage

blib/lib/Text/PDF/File.pm
Criterion Covered Total %
branch 68 168 40.4


line true false branch
213 1 0 unless ($root)
243 0 1 if (ref $fname) { }
255 0 1 if ($update)
262 0 1 if (not $buf =~ /^\%pdf\-1\.(\d)\s*$Text::PDF::File::cr/imo) { }
270 0 1 $end > 1024 ? :
0 1 unless ($fh->seek($end > 1024 ? $end - 1024 : 0, 0))
273 0 1 unless ($buf =~ /startxref$Text::PDF::File::cr([0-9]+)$Text::PDF::File::cr\%\%eof.*?$/io)
318 0 4 if ($force) { }
333 8 23 if (UNIVERSAL::can($item, 'release')) { }
4 19 elsif ($ref eq 'ARRAY') { }
0 19 elsif (UNIVERSAL::isa($ref, 'HASH')) { }
357 0 0 unless $self->{' update'}
360 0 0 if ($self->{' version'} > $self->{' Version'})
369 0 0 if (defined $self->{' newroot'}) { }
377 0 0 unless defined $tdict->{$t}
419 0 1 if (ref $fname) { }
446 0 1 if defined $self->{'Info'}
447 0 1 defined $self->{' newroot'} && $self->{' newroot'} ne '' ? :
454 0 1 if $self->{' loc'}
455 0 1 if ($self->{' update'})
458 0 0 unless defined $tdict->{$t}
467 0 1 if $^O eq 'MacOS' and not ref $self->{' fname'}
490 2 4 if ($str =~ /^<
1 3 elsif ($str =~ /^([0-9]+)$Text::PDF::File::ws_char+([0-9]+)$Text::PDF::File::ws_char+R/so) { }
1 2 elsif ($str =~ /^([0-9]+)$Text::PDF::File::ws_char+([0-9]+)$Text::PDF::File::ws_char+obj/so) { }
0 2 elsif ($str =~ m[^/($Text::PDF::File::reg_char+)]so) { }
0 2 elsif ($str =~ /^\(/o) { }
0 2 elsif ($str =~ /^
0 2 elsif ($str =~ /^\[/o) { }
0 2 elsif ($str =~ /^(true|false)$Text::PDF::File::irreg_char/o) { }
2 0 elsif ($str =~ /^([+-.0-9]+)$Text::PDF::File::irreg_char/o) { }
0 0 elsif ($str =~ /^null$Text::PDF::File::irreg_char/o) { }
498 3 0 if ($str =~ s[^/($Text::PDF::File::reg_char+)][]o)
509 1 1 if ($str =~ s/^stream(?:(?:\015\012)|\012)//o and $res->{'Length'}->val != 0)
515 1 0 unless ($opts{'nostreams'})
517 0 1 if ($k > length $str) { }
532 0 2 if (defined $res->{'Type'} and defined $Text::PDF::File::types{$res->{'Type'}->val})
544 1 0 unless ($res = $self->test_obj($k, $value))
562 0 1 if ($res = $self->test_obj($k, $value)) { }
592 0 0 if ($str =~ /^(\\[()])/o) { }
0 0 elsif ($str =~ /^\)/o) { }
0 0 elsif ($str =~ /^\(/o) { }
603 0 0 if ($nested == 0)
615 0 0 unless $fh->read($str, 255, length $str)
676 0 0 unless $objind eq $res
715 0 5 if $base->is_obj($self)
716 0 5 if (defined $self->{' free'} and scalar @{$self->{' free'};} > 0)
719 0 0 if (defined $base) { }
736 0 5 defined $i ? :
740 0 0 unless (defined $self->locate_obj($i, $ng))
742 0 0 if (defined $base) { }
762 5 0 if (defined $base) { }
789 0 10 if (not defined $self->{' objects'}{$obj->uid}) { }
5 5 elsif (not exists $self->{' outlist_cache'}{$obj->uid}) { }
837 0 0 if $self->{' objcache'}{join $;, $objind->{' objnum'}, $objind->{' objgen'}} eq $objind
859 0 1 unless defined($fh = $self->{' OUTFILE'})
862 1 0 unless scalar @objs > 0
865 0 5 unless $objind->is_obj($self)
869 5 0 if ($self->{' outlist'}[$i] eq $objind)
875 0 5 if $j < 0
878 0 5 if grep {$_ eq $objind;} @{$$self{' free'};}
888 5 0 unless (exists $self->{' printed_cache'}{$objind})
910 0 0 unless defined $out->{$i}
918 0 0 unless $nt eq 'n'
920 0 0 if ($nl < $minl or $mini == 0)
926 0 0 unless ($obj = $self->test_obj($i, $ng))
936 0 0 defined $filt ? :
937 0 0 unless not $res or $res->is_obj($out)
944 0 0 if ($obj->isa('Text::PDF::Dict') and $obj->{'Linearized'})
972 1 0 if (ref $tdict->{' xref'}{$num})
975 1 0 if ($ref->[1] == $gen)
977 1 0 if $ref->[2] eq 'n'
1066 0 1 unless ($buf =~ /^xref$Text::PDF::File::cr/io)
1083 0 1 unless ($buf =~ /^trailer$Text::PDF::File::cr/io)
1091 1 0 if $xmin > $self->{' maxobj'}
1093 0 1 if defined $tdict->{'Prev'} and $tdict->{'Prev'}->val != 0
1141 1 0 unless ($update)
1173 1 5 if ($i > $#xreflist or $self->{' objects'}{$xreflist[$i]->uid}[0] != $j + 1) { }
1175 1 0 $first == -1 ? :
1176 1 0 if ($first == -1)
1178 0 1 defined $freelist[$k] ? :
1184 0 5 if (defined $freelist[$k] and defined $xref and "$freelist[$k]" eq "$xref") { }
1190 0 0 defined $freelist[$k] ? :
1200 0 1 if $i < scalar @xreflist