blib/lib/Template/Plugin/ExifTool.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 91.6% 44 / 48 CC 5 SCAR 7.6
CC
5
Cov
89%
AUTOLOAD
3.6
new
3.0
BEGIN
1.0
CRAP 2.1
↑ Summary
1 package Template::Plugin::ExifTool;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use base qw(Template::Plugin);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use vars qw($VERSION $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 $VERSION = '0.01';
7  
8 2 ▶use Template::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Image::ExifTool;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
12 4 my ($class, $context, $file, @params) = @_;
13 4 ▶ return $class->error("file is not specified") unless $file;
Branch: 1 branch
BranchTrueFalseTotal
unless $file 1 3 4
14 3 ▶ return $class->error("$file: No such file") unless -e $file;
Branch: 1 branch
BranchTrueFalseTotal
unless -e $file 1 2 3
15  
16 2 my $exiftool = Image::ExifTool->new;
17 2 my $info = $exiftool->ImageInfo($file, @params);
18 2 bless {
19 _CONTEXT => $context,
20 _exiftool => $exiftool,
21 _info => $info,
22 }, $class;
23 }
24  
25 2 ▶sub info { shift->{_info} }
Subroutine info: called CC=1 SCAR=0.0
Pod documented
26  
27 1 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=3 SCAR=12.7
28 1 my $self = shift;
29 1 (my $meth = $AUTOLOAD) =~ s/.*:://;
30  
31 1 ▶ if (exists $self->{_info}->{$meth}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{'_info'}{$meth}) { } 0 1 1
elsif ($self->{'_exiftool'}->can($meth)) { } 1 0 1
32 0 return $self->{_info}->{$meth} ;
33 }
34 elsif ($self->{_exiftool}->can($meth)) {
35 1 return $self->{_exiftool}->$meth(@_);
36 }
37 else {
38 0 return;
39 }
40 }
41  
42 2 1;
43  
44 __END__
↑ Summary