Part/Transfer.pm

filter: Statementstmt 51.5% 17 / 33 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 55.5% 5 / 9 Podpod 100% 3 / 3 totaltotal 48.0% 25 / 52 CC 3 SCAR 14.5
CC
3
Cov
45%
_check_part
12.0
new
2.0
element2design
2.0
CRAP 4.3
« Part/Action.pm ↑ Summary Part.pm »
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
BranchTrueFalseTotal
unless (builtin::blessed($part) and $part->isa("Lego::Part")) 0 0 0
Condition0%0/3
builtin::blessed($part) and $part->isa("Lego::Part")
!ll&&!rl&&r
000
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")
ABresult
0X0
100
111
49 0 err "Part must be Lego::Part object.";
50 }
51 0 return;
52 }
53  
54 2 1;
55  
56 __END__
« Part/Action.pm ↑ Summary Part.pm »