Branch Coverage

blib/lib/Image/ExifTool/WritePostScript.pl
Criterion Covered Total %
branch 99 228 43.4


line true false branch
85 1 0 unless $flags->{'WROTE_BEGIN'}
86 0 1 unless &Write($outfile, @_)
87 1 0 unless $flags->{'WROTE_BEGIN'}
100 2 0 $dataPt ? :
101 2 0 $len ? :
116 1 1 if ($dirName eq "XMP" and $len)
119 0 1 unless ($$dataPt =~ /(.*)(<\?xpacket begin=.{7,13}W5M0MpCehiHzreSzNTczkc9d)/gs)
126 0 1 unless ($$dataPt =~ /<\?xpacket end=.(w|r).\?>/gs)
134 1 0 if ($beforeXMP =~ /%begin_xml_packet: (\d+)/s)
137 0 1 unless @matches == 2
140 0 1 unless $reportedLen
147 2 0 if (defined $val) { }
0 0 elsif ($dirName eq 'XMP') { }
151 0 0 unless $len
155 0 2 unless ($len)
156 0 0 if $create or $dirName ne "XMP"
164 0 0 unless $et->{'OPTIONS'}{'Compact'}{'NoPadding'}
172 1 1 if ($dirName eq 'XMP') { }
1 0 elsif ($dirName eq 'Photoshop' or $dirName eq 'ICC_Profile') { }
173 0 1 if ($create) { }
198 0 0 if ($flags->{'EPS'}) { }
216 1 0 if $reportedLen
218 0 1 unless &WriteXMPDir($outfile, $flags, $beforeXMP, $$dataPt, $afterXMP)
224 1 0 if ($dirName eq 'Photoshop') { }
231 0 1 unless &Write($outfile, $startToken, $/)
236 1 39 if $wid > $len - $i
238 0 40 unless &Write($outfile, "% ", uc unpack("H*", $dat), $/)
240 0 1 unless &Write($outfile, $endToken, $/)
256 3 0 unless ($val =~ /^\d+$/)
293 0 1 unless $nvHash->{'IsCreating'}
296 0 1 unless &Write($outfile, &EncodeTag($tag, $val))
300 1 0 if $xmpHint
314 131 1 unless $et
323 0 1 unless $raf->Read($data, 4) == 4
324 0 1 unless $data =~ /^(%!PS|%!Ad|\xc5\xd0\xd3\xc6)/
326 0 1 if ($data =~ /^%!Ad/) { }
0 1 elsif ($data =~ /^\xc5\xd0\xd3\xc6/) { }
328 0 0 unless $raf->Read($buff, 6) == 6 and $buff eq "obe-PS"
336 0 0 unless $raf->Read($dos, 26) == 26
340 0 0 unless ($raf->Seek($psStart, 0) and $raf->Read($data, 4) == 4 and $data eq "%!PS")
349 0 0 if ($base) { }
0 0 elsif (($base = &Get32u(\$dos, 12)) != 0) { }
358 0 0 if ($buff) { }
363 0 0 unless ($raf->Seek($base, 0) and $raf->Read($buff, $len) == $len)
376 0 0 unless ($raf->Seek($base, 0) and $raf->Read($buff, $len) == $len)
386 0 0 unless &Write($outfile, $dos, $buff)
393 0 1 unless ($/ and $raf->ReadLine($buff))
398 0 1 unless ($data =~ /^%!PS-Adobe-3\.(\d+)\b/ and $1 < 2)
399 0 0 if ($et->Error("Document does not conform to DSC spec. Metadata may be unreadable by other apps", 2))
404 0 1 unless &Write($outfile, $data)
405 1 0 if $data =~ /EPSF/
417 1 0 if $addDirs->{'XMP'}
418 0 1 if $et->{'DEL_GROUP'}{'XMP'}
419 1 0 if $xmpHint
422 0 192 unless @lines or &GetNextLine($raf, \@lines)
424 175 17 if ($endToken) { }
7 10 elsif ($data =~ /^(%{1,2})(Begin)(?!Object:)(.*?)[:\x0d\x0a]/i) { }
5 5 elsif ($data =~ /^%%(?!Page:|PlateFile:|BeginObject:)(\w+): ?(.*)/s) { }
0 5 elsif (defined $xmpHint and $data =~ /^%ADO_ContainsXMP:? ?(.+?)[\x0d\x0a]*$/s) { }
426 7 168 if ($data =~ /^$endToken\s*$/is) { }
429 2 5 if ($mode) { }
430 0 2 if $doneDir{$mode}
432 0 2 unless &WritePSDirectory($et, $outfile, $mode, \$buff, \%flags)
434 0 2 if $flags{'WROTE_BEGIN'}
437 0 5 unless &Write($outfile, $data)
441 29 139 if (not defined $mode) { }
126 13 elsif ($mode eq 'XMP') { }
443 0 29 if ($data =~ /^<\?xpacket begin=.{7,13}W5M0MpCehiHzreSzNTczkc9d/ and $editDirs->{'XMP'}) { }
449 0 29 unless &Write($outfile, $data)
462 0 7 if %$newTags
470 0 7 if $verbose > 1
471 1 6 $2 eq 'begin' ? :
473 2 5 if ($mode and $editDirs->{$mode}) { }
478 0 5 unless &Write($outfile, $data)
488 0 5 if ($tag eq "Creator" and $val =~ /^Adobe Illustrator/)
491 0 0 if ($editDirs->{'XMP'})
499 0 0 if ($newTags->{$tag})
504 2 3 if ($newTags->{$tag})
507 0 2 unless ref $tagInfo
510 0 2 if ref $val eq "ARRAY"
512 2 0 if ($et->IsOverwriting($nvHash, $val))
516 0 2 unless defined $val
524 0 0 if ($xmpHint) { }
525 0 0 if $1 eq "NoMain"
534 1 1 if (%$newTags and !($data =~ /^%\S/) || $data =~ /^%(%EndComments|%Page:|%PlateFile:|%BeginObject:|.*BeginLayer)/)
538 0 1 unless &WriteNewTags($et, $outfile, $newTags)
543 1 4 if ($data =~ /^%(%Page:|%PlateFile:|%BeginObject:|.*BeginLayer)/ or not $data =~ /^(%.*|\s*)$/s)
552 3 0 unless $editDirs->{$dir} and not $doneDir{$dir}
553 0 0 if ($plateFile)
558 0 0 unless $addDirs->{$dir} or $dir eq "XMP"
560 0 0 unless &WritePSDirectory($et, $outfile, $dir, undef, \%flags)
564 0 1 if ($flags{'TRAILER'})
567 0 0 unless &Write($outfile, $data)
568 0 0 if (@lines) { }
571 0 0 unless $raf->ReadLine($data)
572 0 0 if $dos
573 0 0 if ($data =~ /[\x0d\x0a]%%EOF\b/g)
581 0 0 if $data =~ /^%%EOF\b/
583 0 0 unless &Write($outfile, $flags{'TRAILER'})
586 1 0 if (defined $data)
587 0 1 unless &Write($outfile, $data)
588 0 1 if @lines
590 0 1 if $dos
591 0 1 unless &Write($outfile, $data)
598 0 9 unless &Write($outfile, $data)
600 0 1 if ($dos and not $err)
602 0 0 if (ref $outfile eq 'SCALAR') { }
606 0 0 unless (seek $outfile, 8, 0 and print $outfile &Set32u($pos - $psNewStart) and seek $outfile, $pos, 0)
616 1 0 unless ($err)
619 0 1 if %$newTags
622 0 2 if $editDirs->{$dir} and not $doneDir{$dir} and not $et->{'DEL_GROUP'}{$dir}
624 0 1 if @notDone
626 0 1 if $endToken
627 0 1 $err ? :