Specs/base/label.pm

filter: Statementstmt 28.2% 11 / 39 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 18.7% 3 / 16 Podpod 0.0% 0 / 13 totaltotal 15.5% 14 / 90 CC 9 SCAR 25.6
CC
9
Cov
19%
label_location
42.0
gutter_cols
6.0
gutter_rows
6.0
CRAP 12.9
« Specs.pm ↑ Summary Specs/base/brand.pm »
1  
2 package Paper::Specs::base::label;
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base qw(Paper::Specs::base::sheet);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 $VERSION=0.01;
8  
9 0 ▶sub type { return 'label' }
Subroutine type: not called CC=1 SCAR=6.9
Pod undocumented
10  
11 # No unit conversion support yet
12  
13 0 ▶sub gutter_cols {
Subroutine gutter_cols: not called CC=2 SCAR=17.9
Pod undocumented
14  
15 0 my $self=shift;
16 0 ▶ return 0 if $self->label_cols <= 1;
Branch: 1 branch
BranchTrueFalseTotal
if $self->label_cols <= 1 0 0 0
17 0 return ($self->sheet_width - $self->margin_left - $self->margin_right - $self->label_cols * $self->label_width )
18 / ($self->label_cols - 1);
19  
20 }
21  
22 0 ▶sub gutter_rows {
Subroutine gutter_rows: not called CC=2 SCAR=17.9
Pod undocumented
23  
24 0 my $self=shift;
25 0 ▶ return 0 if $self->label_rows <= 1;
Branch: 1 branch
BranchTrueFalseTotal
if $self->label_rows <= 1 0 0 0
26 0 return ($self->sheet_height - $self->margin_top - $self->margin_bottom - $self->label_rows * $self->label_height )
27 / ($self->label_rows - 1);
28  
29 }
30  
31 0 ▶sub margin_left { Paper::Specs::convert ($_[0]->specs->{'margin_left'} , $_[0]->specs->{'units'}) }
Subroutine margin_left: not called CC=1 SCAR=6.9
Pod undocumented
32 0 ▶sub margin_right { Paper::Specs::convert ($_[0]->specs->{'margin_right'} , $_[0]->specs->{'units'}) }
Subroutine margin_right: not called CC=1 SCAR=6.9
Pod undocumented
33 0 ▶sub margin_top { Paper::Specs::convert ($_[0]->specs->{'margin_top'} , $_[0]->specs->{'units'}) }
Subroutine margin_top: not called CC=1 SCAR=6.9
Pod undocumented
34 0 ▶sub margin_bottom { Paper::Specs::convert ($_[0]->specs->{'margin_bottom'}, $_[0]->specs->{'units'}) }
Subroutine margin_bottom: not called CC=1 SCAR=6.9
Pod undocumented
35  
36 0 ▶sub label_height { Paper::Specs::convert ($_[0]->specs->{'label_height'}, $_[0]->specs->{'units'}) }
Subroutine label_height: not called CC=1 SCAR=6.9
Pod undocumented
37 0 ▶sub label_width { Paper::Specs::convert ($_[0]->specs->{'label_width'}, $_[0]->specs->{'units'}) }
Subroutine label_width: not called CC=1 SCAR=6.9
Pod undocumented
38  
39 0 ▶sub label_rows { $_[0]->specs->{'label_rows'} }
Subroutine label_rows: not called CC=1 SCAR=6.9
Pod undocumented
40 0 ▶sub label_cols { $_[0]->specs->{'label_cols'} }
Subroutine label_cols: not called CC=1 SCAR=6.9
Pod undocumented
41  
42  
43 0 ▶sub label_location {
Subroutine label_location: not called CC=6 SCAR=37.4
Pod undocumented
44  
45 0 my $self=shift;
46 0 my ($r, $c) = @_;
47  
48 0 ▶ return () if $r > $self->label_rows || $r < 1;
Branch: 1 branch
BranchTrueFalseTotal
if $r > $self->label_rows or $r < 1 0 0 0
Condition0%0/3
$r > $self->label_rows or $r < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$r > $self->label_rows or $r < 1
$r > $self->label_rows $r < 1
Truth table0%0/3
A or B
A= $r > $self->label_rowsB= $r < 1
ABresult
1X1
011
000
49 0 ▶ return () if $c > $self->label_cols || $c < 1;
Branch: 1 branch
BranchTrueFalseTotal
if $c > $self->label_cols or $c < 1 0 0 0
Condition0%0/3
$c > $self->label_cols or $c < 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$c > $self->label_cols or $c < 1
$c > $self->label_cols $c < 1
Truth table0%0/3
A or B
A= $c > $self->label_colsB= $c < 1
ABresult
1X1
011
000
50  
51 0 my $pos_row = $self->margin_top + ($self->label_height + $self->gutter_rows) * ( $r - 1 );
52 0 my $pos_col = $self->margin_left + ($self->label_width + $self->gutter_cols) * ( $c - 1 );
53  
54 0 ▶ if ( Paper::Specs->layout eq 'pdf' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("Paper::Specs"->layout eq "pdf") 0 0 0
55  
56 0 return ( $pos_col, $self->sheet_height - $pos_row );
57  
58 }
59  
60 0 return ($pos_col, $pos_row);
61  
62  
63 }
64  
65 0 ▶sub label_size {
Subroutine label_size: not called CC=2 SCAR=17.9
Pod undocumented
66  
67 0 my $self=shift;
68  
69 0 ▶ if ( Paper::Specs->layout eq 'pdf' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ('Paper::Specs'->layout eq 'pdf') { } 0 0 0
70 0 return ( $self->label_width, -$self->label_height );
71 } else {
72 0 return ( $self->label_width, $self->label_height );
73 }
74  
75 }
76  
77 1 1;
« Specs.pm ↑ Summary Specs/base/brand.pm »