File Coverage

blib/lib/Lego/Part/Image.pm
Criterion Covered Total %
statement 31 33 93.9
branch 4 4 100.0
condition 3 3 100.0
subroutine 9 9 100.0
pod 3 3 100.0
total 50 52 96.1


line stmt bran cond sub pod time code
1             package Lego::Part::Image;
2              
3 21     21   245352 use strict;
  21         43  
  21         748  
4 21     21   161 use warnings;
  21         45  
  21         1477  
5              
6 21     21   5430 use Class::Utils qw(set_params);
  21         172266  
  21         2912  
7 21     21   1198 use Error::Pure qw(err);
  21         2320  
  21         975  
8 21     21   126 use Readonly;
  21         74  
  21         1109  
9 21     21   2502 use Scalar::Util qw(blessed);
  21         73  
  21         7609  
10              
11             # Constants.
12             Readonly::Scalar our $EMPTY_STR => q{};
13              
14             our $VERSION = 0.06;
15              
16             # Constructor.
17             sub new {
18 41     41 1 3746116 my ($class, @params) = @_;
19              
20             # Create object.
21 41         119 my $self = bless {}, $class;
22              
23             # Part object.
24 41         154 $self->{'part'} = undef;
25              
26             # Process parameters.
27 41         169 set_params($self, @params);
28              
29             # Check part object.
30 31 100       434 if (! defined $self->{'part'}) {
31 5         26 err "Parameter 'part' is required.";
32             }
33 26 100 100     281 if (! blessed($self->{'part'})
34             || ! $self->{'part'}->isa('Lego::Part')) {
35              
36 10         280 err "Parameter 'part' must be Lego::Part object.";
37             }
38              
39             # Object.
40 16         76 return $self;
41             }
42              
43             # Get image.
44             sub image {
45 1     1 1 4 my $self = shift;
46              
47             # TODO Implement getting of image with cache.
48 1         5 err "This is abstract class. image() method not implemented.";
49              
50 0         0 return;
51             }
52              
53             # Get image URL.
54             sub image_url {
55 1     1 1 8 my $self = shift;
56              
57 1         7 err "This is abstract class. image_url() method not implemented.";
58              
59 0           return;
60             }
61              
62             1;
63              
64             __END__