File Coverage

blib/lib/Image/MetaData/JPEG/parsers/parsers.pl
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 20 22 90.9


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             package Image::MetaData::JPEG::Segment;
7 15     15   65 no integer;
  15         18  
  15         65  
8 15     15   397 use strict;
  15         23  
  15         372  
9 15     15   64 use warnings;
  15         17  
  15         1999  
10              
11             ###########################################################
12             # This routine is a generic segment parsers, which saves #
13             # the first 30 bytes of the segment in a record, then #
14             # generates an error to inhibit update(). In this way, #
15             # the segment must be rewritten to disk unchanged, but #
16             # the nature of the segment is at least hinted by the #
17             # initial bytes (just for debugging ...). #
18             ###########################################################
19             sub parse_unknown {
20 3     3 0 7 my ($this) = @_;
21             # save the first 30 bytes and translate non-printing characters
22 3         5 my $bytes = 30;
23 3         15 $this->store_record("First $bytes bytes ...", $ASCII, 0, $bytes);
24             # generate an error
25 1         3 $this->die('Unknown segment type');
26             }
27              
28             ###########################################################
29             # This method parses a COM segment. This is very simple #
30             # since it is just one string. #
31             ###########################################################
32             sub parse_com {
33 91     91 0 120 my ($this) = @_;
34             # save the whole comment as a single value
35 91         244 $this->store_record('Comment', $ASCII, 0, $this->size());
36             }
37              
38             ###########################################################
39             # Require all other segment-specific parsers. #
40             ###########################################################
41             require 'Image/MetaData/JPEG/parsers/app0.pl';
42             require 'Image/MetaData/JPEG/parsers/app1.pl';
43             require 'Image/MetaData/JPEG/parsers/app2.pl';
44             require 'Image/MetaData/JPEG/parsers/app3.pl';
45             require 'Image/MetaData/JPEG/parsers/app12.pl';
46             require 'Image/MetaData/JPEG/parsers/app13.pl';
47             require 'Image/MetaData/JPEG/parsers/app14.pl';
48             require 'Image/MetaData/JPEG/parsers/image.pl';
49              
50             # successful package load
51             1;