NG/Excel/Cell.pm

filter: Statementstmt 10.4% 12 / 115 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 36.3% 4 / 11 Podpod 0.0% 0 / 7 totaltotal 11.3% 16 / 141 CC 5 SCAR 13.5
CC
5
Cov
10%
value
6.0
border_left
6.0
border_bottom
6.0
CRAP 3.9
« NG/Time.pm ↑ Summary NG/Log.pm »
1 package NG::Excel::Cell;
2  
3 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use base qw(NG::Object);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
9 0 my ( $pkg, @config ) = @_;
10 0 my $cell = {
11 value => "",
12 width => 10,
13  
14 border_left => {
15 width => 0,
16 style => 'none',
17 color => 0x0000ff,
18 },
19 border_bottom => {
20 width => 0,
21 style => 'none',
22 color => 0x0000ff,
23 },
24  
25 #end of default config
26 @config,
27 };
28 0 return bless $cell, $pkg;
29 }
30  
31 0 ▶sub value {
Subroutine value: not called CC=2 SCAR=17.9
Pod undocumented
32 0 my ( $self, $new_val ) = @_;
33 0 ▶ if ( defined $new_val ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $new_val) { } 0 0 0
34 0 $self->{value} = $new_val;
35 0 return $self;
36 }
37 else {
38 0 return $self->{value};
39 }
40 }
41  
42 0 ▶sub border_left {
Subroutine border_left: not called CC=2 SCAR=17.9
Pod undocumented
43 0 my ( $self, $width, $style, $color ) = @_;
44 0 ▶ if ( scalar(@_) > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ > 1) { } 0 0 0
45 $self->{border_left} = {
46 0 width => $width,
47 style => $style,
48 color => $color,
49 };
50 0 return $self;
51 }
52 else {
53 0 my $border_left = $self->{border_left};
54 return
55 $border_left->{width} . ', '
56 . $border_left->{style} . ', '
57 0 . sprintf( "0x%.6x", $border_left->{color} );
58 }
59  
60 }
61  
62 0 ▶sub border_bottom {
Subroutine border_bottom: not called CC=2 SCAR=17.9
Pod undocumented
63  
64 0 my ( $self, $width, $style, $color ) = @_;
65 0 ▶ if ( scalar(@_) > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ > 1) { } 0 0 0
66 $self->{border_bottom} = {
67 0 width => $width,
68 style => $style,
69 color => $color,
70 };
71 0 return $self;
72 }
73 else {
74 0 my $border_bottom = $self->{border_bottom};
75 return
76 $border_bottom->{width} . ', '
77 . $border_bottom->{style} . ', '
78 0 . sprintf( "0x%.6x", $border_bottom->{color} );
79 }
80 }
81  
82 0 ▶sub width {
Subroutine width: not called CC=2 SCAR=17.9
Pod undocumented
83 0 my ( $self, $new_val ) = @_;
84 0 ▶ if ( defined $new_val ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $new_val) { } 0 0 0
85 0 $self->{width} = $new_val;
86 0 return $self;
87 }
88 else {
89 0 return $self->{width};
90 }
91 }
92  
93 0 ▶sub english_to_num {
Subroutine english_to_num: not called CC=1 SCAR=6.9
Pod undocumented
94 0 my ( $class, $width, $style ) = @_;
95 0 given ( lc $style ) {
96 0 when ('solid') {
97 0 given ($width) {
98 0 when (0) { return 7; }
99 0 when (1) { return 1; }
100 0 when (2) { return 2; }
101 0 when (3) { return 5; }
102 0 default { return 7; }
103 }
104 }
105 0 when ('dash') {
106 0 given ($width) {
107 0 when (1) { return 3; }
108 0 when (2) { return 8; }
109 0 default { return 3; }
110 }
111 }
112 0 when ('dash dot') {
113 0 given ($width) {
114 0 when (1) { return 9; }
115 0 when (2) { return 10; }
116 0 default { return 9; }
117 }
118 }
119 0 when ('dash dot dot') {
120 0 given ($width) {
121 0 when (1) { return 11; }
122 0 when (2) { return 12; }
123 0 default { return 11; }
124 }
125 }
126 0 when ('dot') {
127 0 return 4;
128 }
129 0 when ('slantdash dot') {
130 0 return 13;
131 }
132 0 when ('double') {
133 0 return 6;
134 }
135 0 default { return 0; } #none
136 }
137 }
138  
139 0 ▶sub num_to_english {
Subroutine num_to_english: not called CC=1 SCAR=6.9
Pod undocumented
140 0 my ( $class, $index ) = @_;
141 0 given ($index) {
142 0 when (0) { return ( 'none', 0 ); }
143 0 when (1) { return ( 'solid', 1 ); }
144 0 when (2) { return ( 'solid', 2 ); }
145 0 when (3) { return ( 'dash', 1 ); }
146 0 when (4) { return ( 'dot', 1 ); }
147 0 when (5) { return ( 'solid', 3 ); }
148 0 when (6) { return ( 'double', 3 ); }
149 0 when (7) { return ( 'solid', 0 ); }
150 0 when (8) { return ( 'dash', 2 ); }
151 0 when (9) { return ( 'dash dot', 1 ); }
152 0 when (10) { return ( 'dash dot', 2 ); }
153 0 when (11) { return ( 'dash dot dot', 1 ); }
154 0 when (12) { return ( 'dash dot dot', 2 ); }
155 0 when (13) { return ( 'slantdash dot', 2 ); }
156 0 default { return ( 'none', 0 ); }
157 }
158 }
159 1 1;
« NG/Time.pm ↑ Summary NG/Log.pm »