File Coverage

blib/lib/Metabrik/Image/Jpg.pm
Criterion Covered Total %
statement 9 24 37.5
branch 0 6 0.0
condition n/a
subroutine 3 5 60.0
pod 1 2 50.0
total 13 37 35.1


line stmt bran cond sub pod time code
1             #
2             # $Id$
3             #
4             # image::jpg Brik
5             #
6             package Metabrik::Image::Jpg;
7 1     1   780 use strict;
  1         2  
  1         30  
8 1     1   5 use warnings;
  1         2  
  1         28  
9              
10 1     1   6 use base qw(Metabrik::Shell::Command Metabrik::System::Package);
  1         1  
  1         394  
11              
12             sub brik_properties {
13             return {
14 0     0 1   revision => '$Revision$',
15             tags => [ qw(unstable jpeg) ],
16             author => 'GomoR ',
17             license => 'http://opensource.org/licenses/BSD-3-Clause',
18             commands => {
19             install => [ ], # Inherited
20             info => [ qw(image.jpg) ],
21             },
22             require_binaries => {
23             'jhead' => [ ],
24             },
25             need_packages => {
26             ubuntu => [ qw(jhead) ],
27             debian => [ qw(jhead) ],
28             kali => [ qw(jhead) ],
29             },
30             };
31             }
32              
33             sub info {
34 0     0 0   my $self = shift;
35 0           my ($image) = @_;
36              
37 0 0         $self->brik_help_run_undef_arg('info', $image) or return;
38 0 0         $self->brik_help_run_file_not_found('info', $image) or return;
39              
40 0           my $cmd = "jhead \"$image\"";
41 0 0         my $out = $self->capture($cmd) or return;
42              
43 0           my $info = {};
44 0           for my $this (@$out) {
45 0           my ($key, $val) = $this =~ /^(.*?)\s+:\s+(.*)$/;
46 0           $self->log->debug("info: key [$key] val [$val]");
47 0           $key = lc($key);
48 0           $key =~ s/\s+/_/g;
49 0           $info->{$key} = $val;
50             }
51              
52 0           return $info;
53             }
54              
55             1;
56              
57             __END__