line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lego::Part::Action; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Pragmas. |
4
|
2
|
|
|
2
|
|
38665
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
66
|
|
5
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
80
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Modules. |
8
|
2
|
|
|
2
|
|
1586
|
use Class::Utils qw(set_params); |
|
2
|
|
|
|
|
65307
|
|
|
2
|
|
|
|
|
49
|
|
9
|
2
|
|
|
2
|
|
143
|
use English; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
15
|
|
10
|
2
|
|
|
2
|
|
1111
|
use Error::Pure qw(err); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
530
|
|
11
|
2
|
|
|
2
|
|
12
|
use Scalar::Util qw(blessed); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
697
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Version. |
14
|
|
|
|
|
|
|
our $VERSION = 0.03; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Constructor. |
17
|
|
|
|
|
|
|
sub new { |
18
|
0
|
|
|
0
|
1
|
|
my ($class, @params) = @_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Create object. |
21
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Process parameters. |
24
|
0
|
|
|
|
|
|
set_params($self, @params); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Object. |
27
|
0
|
|
|
|
|
|
return $self; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Load design id to Lego::Part object. |
31
|
|
|
|
|
|
|
sub load_design_id { |
32
|
0
|
|
|
0
|
1
|
|
my ($self, $part_transfer_class, $part) = @_; |
33
|
0
|
|
|
|
|
|
$self->_check_part_transfer_class($part_transfer_class); |
34
|
0
|
|
|
|
|
|
eval { |
35
|
0
|
|
|
|
|
|
$part_transfer_class->element2design($part); |
36
|
|
|
|
|
|
|
}; |
37
|
0
|
0
|
|
|
|
|
if ($EVAL_ERROR) { |
38
|
0
|
|
|
|
|
|
err 'Cannot load design ID.', |
39
|
|
|
|
|
|
|
'Error', $EVAL_ERROR; |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Load element id to Lego::Part object. |
45
|
|
|
|
|
|
|
sub load_element_id { |
46
|
0
|
|
|
0
|
1
|
|
my ($self, $part_transfer_class, $part) = @_; |
47
|
0
|
|
|
|
|
|
$self->_check_part_transfer_class($part_transfer_class); |
48
|
0
|
|
|
|
|
|
eval { |
49
|
0
|
|
|
|
|
|
$part_transfer_class->design2element($part); |
50
|
|
|
|
|
|
|
}; |
51
|
0
|
0
|
|
|
|
|
if ($EVAL_ERROR) { |
52
|
0
|
|
|
|
|
|
err 'Cannot load element ID.', |
53
|
|
|
|
|
|
|
'Error', $EVAL_ERROR; |
54
|
|
|
|
|
|
|
} |
55
|
0
|
|
|
|
|
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Check transfer class. |
59
|
|
|
|
|
|
|
sub _check_part_transfer_class { |
60
|
0
|
|
|
0
|
|
|
my ($self, $part_transfer_class) = @_; |
61
|
0
|
0
|
0
|
|
|
|
if (! blessed($part_transfer_class) |
62
|
|
|
|
|
|
|
|| ! $part_transfer_class->isa('Lego::Part::Transfer')) { |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
err "Bad transfer class. Must be 'Lego::Part::Transfer' ". |
65
|
|
|
|
|
|
|
'class.'; |
66
|
|
|
|
|
|
|
} |
67
|
0
|
|
|
|
|
|
return; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |