File Coverage

blib/lib/Image/MetaData/JPEG/dumpers/app1.pl
Criterion Covered Total %
statement 19 20 95.0
branch 3 4 75.0
condition 2 3 66.6
subroutine 5 5 100.0
pod 0 1 0.0
total 29 33 87.8


line stmt bran cond sub pod time code
1             ###########################################################
2             # A Perl package for showing/modifying JPEG (meta)data. #
3             # Copyright (C) 2004,2005,2006 Stefano Bettelli #
4             # See the COPYING and LICENSE files for license terms. #
5             ###########################################################
6 15     15   62 use Image::MetaData::JPEG::data::Tables qw(:TagsAPP1_Exif :TagsAPP1_XMP);
  15         20  
  15         2759  
7 15     15   76 no integer;
  15         16  
  15         66  
8 15     15   232 use strict;
  15         25  
  15         306  
9 15     15   50 use warnings;
  15         16  
  15         1537  
10              
11             ###########################################################
12             # Entry point for dumping an APP1 segment. It decides #
13             # between Exif APP1 and XMP and then dispatches to the #
14             # correct subroutine (the identifier is not yet written). #
15             ###########################################################
16             sub dump_app1 {
17 163     163 0 197 my ($this) = @_;
18             # Look for the 'Identifier' record (which should always exist and
19             # contain the EXIF tag), and for a 'Namespace' record (Adobe XMP)
20 163         480 my $identif = $this->search_record_value('Identifier');
21 163         393 my $namespace = $this->search_record_value('Namespace');
22             # If the 'Identifier' record exists and contains
23             # the EXIF tag, this is a standard Exif segment
24 163 100 66     737 if ($identif && $identif eq $APP1_EXIF_TAG) { $this->dump_app1_exif(); }
  161 50       575  
25             # Otherwise, look for a 'Namespace' record; chances
26             # are this is an Adobe XMP segment
27 0         0 elsif ($namespace) { return 'Dumping XMP APP1 not implemented'; }
28             # Otherwise, we have a problem
29 2         7 else { return 'Segment dump not possible'; }
30             # return without errors
31 161         633 return undef;
32             }
33              
34             require 'Image/MetaData/JPEG/dumpers/app1_exif.pl';
35             #require 'Image/MetaData/JPEG/dumpers/app1_xmp.pl';
36              
37             # successful load
38             1;