File Coverage

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


line stmt bran cond sub pod time code
1             package Lego::Part::Image::LegoCom;
2              
3 4     4   189961 use base qw(Lego::Part::Image);
  4         9  
  4         1983  
4 4     4   30 use strict;
  4         8  
  4         95  
5 4     4   17 use warnings;
  4         7  
  4         222  
6              
7 4     4   20 use Error::Pure qw(err);
  4         7  
  4         3886  
8              
9             our $VERSION = 0.06;
10              
11             # Get image URL.
12             sub image_url {
13 2     2 1 13 my $self = shift;
14              
15 2 100       10 if (! defined $self->{'part'}->element_id) {
16 1         14 err "Element ID doesn't defined.";
17             }
18             my $url = sprintf 'https://www.lego.com/cdn/product-assets/element.img.lod5photo.192x192/%s.jpg',
19 1         10 $self->{'part'}->element_id;
20              
21 1         13 return $url;
22             }
23              
24             1;
25              
26             __END__