File Coverage

lib/URI/Title/Image.pm
Criterion Covered Total %
statement 16 16 100.0
branch 1 2 50.0
condition 1 3 33.3
subroutine 5 5 100.0
pod 0 2 0.0
total 23 28 82.1


line stmt bran cond sub pod time code
1             package URI::Title::Image;
2             $URI::Title::Image::VERSION = '1.902';
3 2     2   1624 use warnings;
  2         5  
  2         55  
4 2     2   8 use strict;
  2         4  
  2         35  
5              
6 2     2   1376 use Image::Size;
  2         9463  
  2         414  
7              
8             sub types {(
9 2     2 0 8 'image/gif',
10             'image/jpg',
11             'image/jpeg',
12             'image/png',
13             'image/x-png',
14             )}
15              
16             sub title {
17 1     1 0 4 my ($class, $url, $data, $type) = @_;
18 1         4 my $name = ( split m{/}, $url )[-1];
19              
20 1         6 my ($x, $y) = imgsize(\$data);
21 1         97 $type =~ s!^[^/]*/!!;
22 1         4 $type =~ s!^x-!!;
23 1 50 33     17 return $x && $y
24             ? "$name ($type ${x}x${y})"
25             : "$name ($type)";
26             }
27              
28             1;
29              
30             __END__