Branch Coverage

blib/lib/Image/ExifTool/WriteIPTC.pl
Criterion Covered Total %
branch 165 248 66.5


line true false branch
87 0 2 unless ($code)
88 0 0 if (($code = $val) =~ s/ESC */\e/gi) { }
106 45 250 if ($format =~ /^int(\d+)/) { }
250 0 elsif ($format =~ /^(string|digits|undef)\[?(\d+),?(\d*)\]?$/) { }
108 0 45 if ($bytes != 1 and $bytes != 2 and $bytes != 4)
112 4 41 unless (&Image::ExifTool::IsInt($val))
113 4 0 unless &Image::ExifTool::IsHex($val)
118 0 41 if $val
122 25 225 if ($fmt eq "digits")
123 0 25 unless $$valPtr =~ /^\d*$/
124 3 22 if ($len < $minlen and $len)
130 25 225 if (defined $minlen and $fmt ne "string")
131 25 0 unless $maxlen
132 0 25 if ($len < $minlen) { }
0 50 elsif ($len > $maxlen and not $et->{'OPTIONS'}{'IgnoreMinorErrors'}) { }
133 0 0 unless ($et->{'OPTIONS'}{'IgnoreMinorErrors'})
158 0 314 unless $format
159 41 273 if ($format =~ /^int(\d+)/) { }
252 21 elsif ($format =~ /^string/) { }
160 6 35 if ($read) { }
162 6 0 if ($len <= 8)
172 0 35 if ($len == 1) { }
33 2 elsif ($len == 2) { }
181 2 250 if ($rec == 1) { }
1 249 elsif ($$xlatPtr and $rec < 7 and $$valPtr =~ /[\x80-\xff]/) { }
182 2 0 if ($tagInfo->{'Name'} eq "CodedCharacterSet")
189 165 87 if (not $read and $format =~ /^string\[(\d+),?(\d*)\]$/)
192 1 164 unless $maxlen
193 0 165 if ($len < $minlen) { }
2 163 elsif ($len > $maxlen) { }
194 0 0 if ($et->Warn("String too short for IPTC:$tagInfo->{'Name'} (padded)", 2))
198 2 0 if ($et->Warn("IPTC:$tagInfo->{'Name'} exceeds length limit (truncated)", 2))
201 1 1 if (($$xlatPtr || $et->Options('Charset')) eq "UTF8")
218 0 12 unless ($val =~ s[^.*(\d{4})[-:/.]?(\d{2})[-:/.]?(\d{2}).*][$1$2$3]s)
232 1 0 if ($val =~ /(.*?)\b(\d{1,2})(:?)(\d{2})(:?)(\d{2})(\S*)\s*$/s and $3 || !$5) { }
235 1 0 if ($tz =~ /([+-]\d{1,2}):?(\d{2})/) { }
0 0 elsif ($tz =~ /Z/i) { }
242 0 0 if ($date and $date =~ /^(\d{4}):(\d{2}):(\d{2})\s*$/ and eval { do { require Time::Local } }) { }
274 0 11 if lc $val eq "now"
285 0 0 if ($val eq "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000") { }
0 0 elsif (length $val >= 16) { }
291 0 0 if $manu
312 0 0 if (@vals >= 4) { }
0 0 elsif ($val =~ /unknown/i) { }
339 25 0 unless exists $et->{'EDIT_DIRS'}{$dirInfo->{'DirName'}} or $tagTablePtr eq \%Image::ExifTool::IPTC::Main and exists $et->{'EDIT_DIRS'}{'IPTC'}
341 22 18 unless ($dataPt)
351 1 39 if $xlat eq $et->Options("Charset")
354 22 18 unless (defined $dirLen)
356 22 0 unless defined $dataLen
360 0 17 if ($dirLen >= 4 and substr($$dataPt, $start, 1) ne "\34" and substr($$dataPt, $start + 3, 1) eq "\34")
373 0 268 unless $tagInfo->{'SubDirectory'}
374 0 268 unless my $table = $tagInfo->{'SubDirectory'}{'TagTable'}
385 2082 170 unless defined $record
386 44 126 unless defined $iptcInfo{$record}
419 248 39 if ($pos + 5 <= $dirEnd)
422 247 1 if ($id == 28) { }
423 0 247 if ($rec < $lastRec)
424 0 0 if ($rec == 0) { }
425 0 0 if $et->Warn("IPTC record 0 encountered, subsequent records ignored", 2)
430 0 0 if $et->Warn("IPTC doesn't conform to spec: Records out of sequence", 2)
435 0 247 if ($len & 32768)
437 0 0 if ($pos + $n <= $dirEnd and $n <= 8) { }
450 0 247 if $pos > $dirEnd
457 127 160 if ($writeRec or $addNow)
460 72 228 if ($addNow) { }
84 144 elsif (not defined $newRec or $newRec != $lastRec) { }
464 44 40 if (length $newData > $lastRecPos)
465 3 41 if ($allMandatory > 1) { }
39 2 elsif ($mandatory{$lastRec} and $tagTablePtr eq \%Image::ExifTool::IPTC::Main) { }
472 0 6 if $code & 4
473 3 3 if ($code & 3) == 1
475 3 0 if ($num)
477 0 3 if $verbose > 1
486 17 22 if $foundRec{$lastRec}{$mandTag}
487 22 0 unless ($subTablePtr)
489 0 22 unless $tagInfo and $tagInfo->{'SubDirectory'}
490 0 22 unless $tagInfo->{'SubDirectory'}{'TagTable'}
493 0 22 unless $tagInfo = $subTablePtr->{$mandTag}
507 40 44 unless defined $newRec
512 188 72 unless ($addNow)
516 18 170 if defined $rec and $rec <= $newRec
524 148 94 if ($found & 2) { }
32 62 elsif ($tagInfo->{'List'}) { }
526 76 72 unless $found & 4
529 2 30 $found ? :
30 2 if $found ? !$nvHash->{'CreateOnly'} : $nvHash->{'IsCreating'}
532 61 0 if not $found and $nvHash->{'IsCreating'}
534 167 75 if ($doSet)
536 163 4 if @values
542 40 153 if ($allMandatory)
544 33 7 unless $mandatory and $mandatory->{$newTag}
552 193 0 if ($len <= 32767) { }
563 72 170 if ($addNow)
565 3 69 if $writeRec
570 44 126 unless @{$iptcInfo{$newRec};}
572 58 69 if ($writeRec)
574 40 18 unless defined $rec
585 99 148 if ($tagInfo) { }
0 295 elsif ($rec == 1 and $tag == 90) { }
590 87 12 if $tagInfo->{'Format'} and $tagInfo->{'Format'} =~ /^string/
593 89 10 if ($et->IsOverwriting($nvHash, $val))
600 14 75 if $allMandatory
602 72 12 if ($nvHash->{'Value'} and @{$nvHash->{'Value'};} and @recordList and $recordList[0] == $rec and not $foundRec{$rec}{$tag} & 4)
615 20 138 if ($allMandatory)
617 8 12 unless ($mandatory and $mandatory->{$tag})
625 4 36 if ($tail < $dirEnd)
627 0 4 if ($pad =~ /[^\0]/)
628 0 0 if $et->Warn("Unrecognized data in IPTC padding", 2)
642 370 65 unless $et
650 60 1 unless defined $nvHash
651 0 1 unless &IsStandardIPTC(scalar $et->MetadataPath)
653 1 0 if $nvHash->{'DelValue'}
656 0 1 unless $new or $old
657 0 1 unless (eval { do { require Digest::MD5 } })
662 1 0 if ($new)
663 1 0 if (defined $newData) { }
667 0 0 if ($dirInfo->{'DirStart'} or length $$dataPt != $dirInfo->{'DirLen'})
673 1 0 if length $$dataPt
675 1 0 if ($old)
676 0 1 if ($new and not defined $newData) { }
1 0 elsif ($dirInfo->{'DataPt'}) { }
680 1 0 if ($dirInfo->{'DirStart'} or length $$dataPt != $dirInfo->{'DirLen'})
684 1 0 if length $$dataPt
690 0 38 if defined $newData and length $newData and $et->{'FORCE_WRITE'}{'IPTC'}