File Coverage

blib/lib/App/MaMGal/ImageInfo/ExifTool.pm
Criterion Covered Total %
statement 30 30 100.0
branch 2 2 100.0
condition n/a
subroutine 10 10 100.0
pod 0 5 0.0
total 42 47 89.3


line stmt bran cond sub pod time code
1             # mamgal - a program for creating static image galleries
2             # Copyright 2009 Marcin Owsiany
3             # See the README file for license information
4             # A wrapper class for the Image::ExifTool library.
5             package App::MaMGal::ImageInfo::ExifTool;
6 2     2   10 use strict;
  2         2  
  2         61  
7 2     2   10 use warnings;
  2         3  
  2         46  
8 2     2   8 use base 'App::MaMGal::ImageInfo::Base';
  2         4  
  2         1041  
9 2     2   10 use Carp;
  2         16  
  2         100  
10              
11 2     2   9350 use Image::ExifTool 'ImageInfo';
  2         118142  
  2         730  
12              
13             sub get_info
14             {
15 109     109 0 178 my $self = shift;
16 109         195 my $file = shift;
17 109         901 my $tool = Image::ExifTool->new;
18 109         67777 my $ret = $tool->ExtractInfo($file, [qw(Comment exif:CreateDate exif:ModifyDate exif:DateTimeOriginal)]);
19 109         2468905 my $info = $tool->GetInfo;
20 109 100       897289 croak $info->{Error} unless $ret;
21 108         13767 return $info;
22             }
23              
24             sub datetime_original_string
25             {
26 19     19 0 354 my $self = shift;
27 19         91 $self->{info}->{DateTimeOriginal};
28             }
29              
30             sub datetime_digitized_string
31             {
32 17     17 0 390 my $self = shift;
33 17         85 $self->{info}->{CreateDate};
34             }
35              
36             sub datetime_string
37             {
38 13     13 0 367 my $self = shift;
39 13         59 $self->{info}->{ModifyDate};
40             }
41              
42             sub description
43             {
44 6     6 0 407 my $self = shift;
45 6         37 $self->{info}->{Comment};
46             }
47              
48             1;