File Coverage

blib/lib/Lego/Part/Image/LegoCom.pm
Criterion Covered Total %
statement 12 19 63.1
branch 0 2 0.0
condition n/a
subroutine 4 6 66.6
pod 1 1 100.0
total 17 28 60.7


line stmt bran cond sub pod time code
1             package Lego::Part::Image::LegoCom;
2              
3             # Pragmas.
4 4     4   77192 use base qw(Lego::Part::Image);
  4         7  
  4         1921  
5 4     4   18 use strict;
  4         8  
  4         69  
6 4     4   31 use warnings;
  4         8  
  4         93  
7              
8             # Modules.
9 4     4   17 use Error::Pure qw(err);
  4         6  
  4         487  
10              
11             # Version.
12             our $VERSION = 0.04;
13              
14             # Get image URL.
15             sub image_url {
16 0     0 1   my $self = shift;
17 0 0         if (! defined $self->{'part'}->element_id) {
18 0           err "Element ID doesn't defined.";
19             }
20             my $url = sprintf 'http://cache.lego.com/media/bricks/5/%s/%s.jpg',
21 0           $self->_zoom, $self->{'part'}->element_id;
22 0           return $url;
23             }
24              
25             # lego.com zoom rutine.
26             sub _zoom {
27 0     0     my $self = shift;
28             # TODO Better resolution? 2/3 in lego.com
29 0           return 2;
30             }
31              
32             1;
33              
34             __END__