line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lego::Part::Image; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Pragmas. |
4
|
18
|
|
|
18
|
|
136168
|
use strict; |
|
18
|
|
|
|
|
32
|
|
|
18
|
|
|
|
|
434
|
|
5
|
18
|
|
|
18
|
|
81
|
use warnings; |
|
18
|
|
|
|
|
34
|
|
|
18
|
|
|
|
|
506
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Modules. |
8
|
18
|
|
|
18
|
|
8684
|
use Class::Utils qw(set_params); |
|
18
|
|
|
|
|
319962
|
|
|
18
|
|
|
|
|
490
|
|
9
|
18
|
|
|
18
|
|
781
|
use Error::Pure qw(err); |
|
18
|
|
|
|
|
34
|
|
|
18
|
|
|
|
|
631
|
|
10
|
18
|
|
|
18
|
|
84
|
use Readonly; |
|
18
|
|
|
|
|
30
|
|
|
18
|
|
|
|
|
682
|
|
11
|
18
|
|
|
18
|
|
86
|
use Scalar::Util qw(blessed); |
|
18
|
|
|
|
|
31
|
|
|
18
|
|
|
|
|
4640
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Constants. |
14
|
|
|
|
|
|
|
Readonly::Scalar our $EMPTY_STR => q{}; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Version. |
17
|
|
|
|
|
|
|
our $VERSION = 0.04; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Constructor. |
20
|
|
|
|
|
|
|
sub new { |
21
|
26
|
|
|
26
|
1
|
32834
|
my ($class, @params) = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Create object. |
24
|
26
|
|
|
|
|
54
|
my $self = bless {}, $class; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Part object. |
27
|
26
|
|
|
|
|
75
|
$self->{'part'} = undef; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Process parameters. |
30
|
26
|
|
|
|
|
94
|
set_params($self, @params); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Check part object. |
33
|
18
|
100
|
|
|
|
183
|
if (! defined $self->{'part'}) { |
34
|
4
|
|
|
|
|
15
|
err "Parameter 'part' is required."; |
35
|
|
|
|
|
|
|
} |
36
|
14
|
100
|
66
|
|
|
177
|
if (! blessed($self->{'part'}) |
37
|
|
|
|
|
|
|
|| ! $self->{'part'}->isa('Lego::Part')) { |
38
|
|
|
|
|
|
|
|
39
|
8
|
|
|
|
|
172
|
err "Parameter 'part' must be Lego::Part object."; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Object. |
43
|
6
|
|
|
|
|
23
|
return $self; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Get image. |
47
|
|
|
|
|
|
|
sub image { |
48
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
49
|
|
|
|
|
|
|
# TODO Implement getting of image with cache. |
50
|
1
|
|
|
|
|
5
|
err "This is abstract class. image() method not implemented."; |
51
|
0
|
|
|
|
|
0
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Get image URL. |
55
|
|
|
|
|
|
|
sub image_url { |
56
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
57
|
1
|
|
|
|
|
6
|
err "This is abstract class. image_url() method not implemented."; |
58
|
0
|
|
|
|
|
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |