File Coverage

blib/lib/Plucene/SearchEngine/Index/Image.pm
Criterion Covered Total %
statement 25 25 100.0
branch 1 2 50.0
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 33 35 94.2


line stmt bran cond sub pod time code
1             package Plucene::SearchEngine::Index::Image;
2 1     1   176619 use strict;
  1         3  
  1         32  
3 1     1   5 use warnings;
  1         2  
  1         30  
4 1     1   12 use base 'Plucene::SearchEngine::Index::Base';
  1         6  
  1         1016  
5 1     1   22037 use Image::Info qw(image_info dim);
  1         1764  
  1         86  
6 1     1   6 use Time::Piece;
  1         2  
  1         8  
7 1     1   1370 use Date::Parse;
  1         6326  
  1         327  
8              
9             our $VERSION = '0.01';
10              
11             __PACKAGE__->register_handler(qw(
12             image/bmp .bmp
13             image/gif .gif
14             image/jpeg jpeg jpg jpe
15             image/png png
16             image/x-portable-bitmap pbm
17             image/x-portable-graymap pgm
18             image/x-portable-pixmap ppm
19             image/svg+xml svg
20             image/tiff tiff tif
21             image/x-xbitmap xbm
22             image/x-xpixmap xpm
23             ));
24              
25             sub gather_data_from_file {
26 1     1 0 14348 my ($self, $filename) = @_;
27 1         8 my $info = image_info($filename);
28 1 50       73633 return if $info->{error};
29 1         7 $self->add_data("size", "Text", scalar dim($info));
30 1         34 $self->add_data("text", "UnStored", $info->{Comment});
31 1         14 $self->add_data("subtype", "Text", $info->{file_ext});
32 1         15 $self->add_data("created", "Date", Time::Piece->new(str2time($info->{LastModificationTime})));
33             }
34              
35             1;
36             __END__