| 1 | package Lego::Part::Transfer; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # Pragmas. | ||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # Modules. | ||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Class::Utils qw(set_params); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Error::Pure qw(err); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # Version. | ||||||||||||||||||||||||||||
| 13 | 2 | our $VERSION = 0.03; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | # Constructor. | ||||||||||||||||||||||||||||
| 16 | sub new { | ||||||||||||||||||||||||||||
| 17 | 0 | ▶ | my ($class, @params) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 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 | ▶ | my ($self, $part) = @_; | ||||||||||||||||||||||||||
|
Subroutine
element2design: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 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 | ▶ | my ($self, $part) = @_; | ||||||||||||||||||||||||||
|
Subroutine
design2element: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 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 | ▶ | my ($self, $part) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_check_part: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | if (! blessed($part) || ! $part->isa('Lego::Part')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($part) and $part->isa("Lego::Part")
MC/DC0%0/2
builtin::blessed($part) and $part->isa("Lego::Part")
builtin::blessed($part)
$part->isa("Lego::Part")
Truth table0%0/3
A and B
A= builtin::blessed($part)B= $part->isa("Lego::Part")
| |||||||||||||||||||||||||||||
| 49 | 0 | err "Part must be Lego::Part object."; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 0 | return; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 2 | 1; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | __END__ | ||||||||||||||||||||||||||||