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__ |