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 4     4   152211 use base qw(Lego::Part::Image);
  4         7  
  4         2060  
4 4     4   21 use strict;
  4         6  
  4         72  
5 4     4   13 use warnings;
  4         7  
  4         190  
6              
7 4     4   17 use Error::Pure qw(err);
  4         5  
  4         766  
8              
9             our $VERSION = 0.06;
10              
11             # Get image URL.
12             sub image_url {
13 3     3 1 4 my $self = shift;
14              
15 3 100       6 if (! defined $self->{'part'}->color) {
16 1         11 err "Color doesn't defined.";
17             }
18 2 100       14 if (! defined $self->{'part'}->design_id) {
19 1         7 err "Design ID doesn't defined.";
20             }
21             my $url = sprintf 'http://media.peeron.com/ldraw/images/%d/100/%s.png',
22 1         5 $self->{'part'}->color, $self->{'part'}->design_id;
23              
24 1         11 return $url;
25             }
26              
27             1;
28              
29             __END__