File Coverage

blib/lib/Lego/Part/Image/PeeronCom.pm
Criterion Covered Total %
statement 19 19 100.0
branch 4 4 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
1             package Lego::Part::Image::PeeronCom;
2              
3             # Pragmas.
4 4     4   81385 use base qw(Lego::Part::Image);
  4         8  
  4         1992  
5 4     4   19 use strict;
  4         6  
  4         73  
6 4     4   47 use warnings;
  4         7  
  4         97  
7              
8             # Modules.
9 4     4   16 use Error::Pure qw(err);
  4         8  
  4         538  
10              
11             # Version.
12             our $VERSION = 0.05;
13              
14             # Get image URL.
15             sub image_url {
16 3     3 1 7 my $self = shift;
17 3 100       11 if (! defined $self->{'part'}->color) {
18 1         11 err "Color doesn't defined.";
19             }
20 2 100       18 if (! defined $self->{'part'}->design_id) {
21 1         10 err "Design ID doesn't defined.";
22             }
23             my $url = sprintf 'http://media.peeron.com/ldraw/images/%d/100/%s.png',
24 1         9 $self->{'part'}->color, $self->{'part'}->design_id;
25 1         13 return $url;
26             }
27              
28             1;
29              
30             __END__