EPL2/Pad.pm

filter: Statementstmt 68.9% 71 / 103 Branchbran 16.6% 4 / 24 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 85.7% 18 / 21 Podpod n/a totaltotal 59.4% 94 / 158 CC 19 SCAR 29.0
CC
19
Cov
57%
__ANON__
38.0
process
38.0
__ANON__
2.4
CRAP 18.2
↑ Summary EPL2/Types.pm »
1 package EPL2::Pad;
2 # ABSTRACT: Pad (Describe Printer Label)
3 1 $EPL2::Pad::VERSION = '0.001';
4 2 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use MooseX::Method::Signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use EPL2::Types qw(Padwidth Padheight Natural Positive);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use EPL2::Command::A;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use EPL2::Command::B;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use EPL2::Command::O;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use EPL2::Command::N;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use EPL2::Command::Q;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use EPL2::Command::qq;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use EPL2::Command::P;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 #Public Attributes
19 1 has continuous => ( is => 'rw', isa => 'Bool', default => 1, );
20 1 has number_sets => ( is => 'rw', isa => Natural, default => 1, );
21 1 has number_copies => ( is => 'rw', isa => Natural, default => 0, );
22 1 has clear_image_buffer => ( is => 'rw', isa => 'Bool', default => 1, );
23 1 has height => ( is => 'rw', isa => Padheight, default => 0, );
24 1 has width => ( is => 'rw', isa => Padwidth, default => 0, );
25  
26 #Private Attributes
27 1 ▶has commands => ( is => 'ro', isa => 'ArrayRef', default => sub { []; }, init_arg => undef, );
Subroutine __ANON__: called CC=1 SCAR=0.0
28  
29 #Methods
30 0 ▶method add_command( EPL2::Command $command ) {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=3.5
31 0 push @{ $self->commands }, $command;
32 1 }
33  
34 0 ▶method process () {
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine __ANON__: not called CC=9 SCAR=36.4
Subroutine process: called CC=9 SCAR=36.4
35 0 my ( $needed_height, @com ) = ( $self->height );
36 0 for my $com ( @{ $self->commands } ) {
37 0 my $this_height = 0;
38 0 ▶ if ( blessed $com eq 'EPL2::Command::A' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (builtin::blessed($com) eq "EPL2::Command::A") 0 0 0
if (builtin::blessed($com) eq "EPL2::Command::A") 0 0 0
39 0 $this_height = $com->height + $com->v_pos;
40 0 ▶ $needed_height = $this_height if ( $this_height > $needed_height );
Branch: 2 branches
BranchTrueFalseTotal
if $this_height > $needed_height 0 0 0
if $this_height > $needed_height 0 0 0
41 }
42 0 push @com, $com;
43 }
44  
45 0 ▶ if ( $self->continuous || $self->height ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->continuous or $self->height) 0 0 0
if ($self->continuous or $self->height) 2 0 2
Condition16%1/6
$self->continuous or $self->height
l!l&&r!l&&!r
000
$self->continuous or $self->height
l!l&&r!l&&!r
200
MC/DC0%0/2
$self->continuous or $self->height
$self->continuous $self->height
MC/DC0%0/2
$self->continuous or $self->height
$self->continuous $self->height
Truth table0%0/3
A or B
A= $self->continuousB= $self->height
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= $self->continuousB= $self->height
ABresult
1X1
011
000
46 0 my $height = $self->height;
47 0 ▶ if ( $self->continuous ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->continuous) 0 0 0
if ($self->continuous) 2 0 2
48 0 $height += $needed_height;
49 }
50 0 unshift @com, EPL2::Command::Q->new( height => $height );
51 }
52  
53 0 ▶ unshift @com, EPL2::Command::qq->new( width => $self->width ) if ( $self->width );
Branch: 2 branches
BranchTrueFalseTotal
if $self->width 0 0 0
if $self->width 0 2 2
54 0 unshift @com, EPL2::Command::O->new;
55 0 ▶ unshift @com, EPL2::Command::N->new if ( $self->clear_image_buffer );
Branch: 2 branches
BranchTrueFalseTotal
if $self->clear_image_buffer 0 0 0
if $self->clear_image_buffer 2 0 2
56 0 push @com, EPL2::Command::P->new( number_sets => $self->number_sets, number_copies => $self->number_copies );
57 0 return @com;
58 1 }
59  
60 0 ▶method string ( Str :$delimiter = "\n" ) {
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine __ANON__: not called CC=2 SCAR=8.7
Subroutine string: called CC=2 SCAR=8.7
61 0 my $string = '';
62 0 for my $com ( $self->process ) {
63 0 $string .= $com->string( delimiter => $delimiter );
64 }
65 0 return $string;
66 1 }
67  
68 1 __PACKAGE__->meta->make_immutable;
69  
70 1 1;
71  
72 __END__
↑ Summary EPL2/Types.pm »