line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lego::Part::Transfer; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Pragmas. |
4
|
3
|
|
|
3
|
|
32662
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
64
|
|
5
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
78
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Modules. |
8
|
3
|
|
|
3
|
|
2054
|
use Class::Utils qw(set_params); |
|
3
|
|
|
|
|
78427
|
|
|
3
|
|
|
|
|
65
|
|
9
|
3
|
|
|
3
|
|
188
|
use Error::Pure qw(err); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
113
|
|
10
|
3
|
|
|
3
|
|
16
|
use Scalar::Util qw(blessed); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
718
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Version. |
13
|
|
|
|
|
|
|
our $VERSION = 0.02; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Constructor. |
16
|
|
|
|
|
|
|
sub new { |
17
|
0
|
|
|
0
|
1
|
|
my ($class, @params) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Create object. |
20
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Process parameters. |
23
|
0
|
|
|
|
|
|
set_params($self, @params); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Object. |
26
|
0
|
|
|
|
|
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Convert element to design. |
30
|
|
|
|
|
|
|
sub element2design { |
31
|
0
|
|
|
0
|
1
|
|
my ($self, $part) = @_; |
32
|
0
|
|
|
|
|
|
$self->_check_part($part); |
33
|
0
|
|
|
|
|
|
err "This is abstract class. element2design() method not implemented."; |
34
|
0
|
|
|
|
|
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Convert design to element. |
38
|
|
|
|
|
|
|
sub design2element { |
39
|
0
|
|
|
0
|
1
|
|
my ($self, $part) = @_; |
40
|
0
|
|
|
|
|
|
$self->_check_part($part); |
41
|
0
|
|
|
|
|
|
err "This is abstract class. design2element() method not implemented."; |
42
|
0
|
|
|
|
|
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Check part class. |
46
|
|
|
|
|
|
|
sub _check_part { |
47
|
0
|
|
|
0
|
|
|
my ($self, $part) = @_; |
48
|
0
|
0
|
0
|
|
|
|
if (! blessed($part) || ! $part->isa('Lego::Part')) { |
49
|
0
|
|
|
|
|
|
err "Part must be Lego::Part object."; |
50
|
|
|
|
|
|
|
} |
51
|
0
|
|
|
|
|
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |