File Coverage

blib/lib/Image/Delivery/Provider/IOHandle.pm
Criterion Covered Total %
statement 16 21 76.1
branch 0 4 0.0
condition n/a
subroutine 6 7 85.7
pod 0 1 0.0
total 22 33 66.6


line stmt bran cond sub pod time code
1             package Image::Delivery::Provider::IOHandle;
2              
3 2     2   1719 use strict;
  2         4  
  2         64  
4 2     2   10 use UNIVERSAL 'isa';
  2         4  
  2         10  
5 2     2   630 use base 'Image::Delivery::Provider::Scalar';
  2         5  
  2         131  
6 2     2   10 use File::Slurp ();
  2         4  
  2         38  
7              
8 2     2   7 use vars qw{$VERSION};
  2         2  
  2         90  
9             BEGIN {
10 2     2   261 $VERSION = '0.14';
11             }
12              
13              
14              
15              
16              
17             #####################################################################
18             # Constructor
19              
20             sub new {
21 0     0 0   my $class = shift;
22 0 0         my $handle = isa(ref $_[0], 'IO::Handle') ? shift : return undef;
23              
24             # Slurp in the image
25 0           my $image = File::Slurp::read_file( $handle, scalar_ref => 1 );
26 0 0         return undef unless ref $image eq 'SCALAR';
27              
28             # Hand off to our parent
29 0           $class->SUPER::new( $image, @_ );
30             }
31              
32             1;