File Coverage

blib/lib/Lego/Part/Image/LegoCom.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 28 28 100.0


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