Firemen/Option/Check.pm

filter: Statementstmt 25.5% 12 / 47 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 30.0% 3 / 10 Podpod 100% 7 / 7 totaltotal 28.9% 22 / 76 CC 7 SCAR 20.6
CC
7
Cov
20%
new
20.0
setOption
6.0
setErrorString
6.0
CRAP 7.8
« Firemen/Load.pm ↑ Summary Firemen.pm »
1 #!/usr/bin/perl
2 ######################
3 #
4 # Copyright (C) 2011 TU Clausthal, Institut fuer Maschinenwesen, Joachim Langenbach
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #
19 ######################
20  
21 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 # Pod::Weaver infos
25 # ABSTRACT: An option check error
26  
27 package CAD::Firemen::Option::Check;
28 {
29 6 $CAD::Firemen::Option::Check::VERSION = '0.7.1';
30 }
31 6 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 sub new {
34 0 ▶ my ($class) = shift;
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
35 0 my (%params) = @_;
36  
37 # check parameters
38 0 ▶ if(!exists($params{"name"})){
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $params{"name"}) 0 0 0
39 0 $params{"name"} = "";
40 }
41 #if(!exists($params{"line"})){
42 # $params{"line"} = "";
43 #}
44 0 ▶ if(!exists($params{"errorString"})){
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $params{"errorString"}) 0 0 0
45 0 $params{"errorString"} = "";
46 }
47 0 ▶ if(!exists($params{"case"})){
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $params{"case"}) 0 0 0
48 0 $params{"case"} = 0;
49 }
50  
51 my $self = {
52 '_option' => $params{"name"},
53 #'_line' => $params{"line"}
54 '_errorString' => $params{"errorString"},
55 0 '_case' => $params{"case"}
56 };
57 0 bless $self, $class;
58 0 return $self;
59 }
60  
61 sub setOption {
62 0 ▶ my $self = shift;
Subroutine setOption: not called CC=2 SCAR=17.9
Pod documented
63 0 my $name = shift;
64 0 ▶ if(!defined($name)){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $name) 0 0 0
65 0 return 0;
66 }
67 0 $self->{'_option'} = $name;
68 0 return 1;
69 }
70  
71 sub option {
72 0 ▶ my $self = shift;
Subroutine option: not called CC=1 SCAR=6.9
Pod documented
73 0 return $self->{'_option'};
74 }
75  
76 sub setErrorString {
77 0 ▶ my $self = shift;
Subroutine setErrorString: not called CC=2 SCAR=17.9
Pod documented
78 0 my $string = shift;
79 0 ▶ if(!defined($string)){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 0 0 0
80 0 return 0;
81 }
82 0 $self->{'_errorString'} = $string;
83 0 return 1;
84 }
85  
86 sub errorString {
87 0 ▶ my $self = shift;
Subroutine errorString: not called CC=1 SCAR=6.9
Pod documented
88 0 return $self->{'_errorString'};
89 }
90  
91 sub setCase {
92 0 ▶ my $self = shift;
Subroutine setCase: not called CC=2 SCAR=17.9
Pod documented
93 0 my $case = shift;
94 0 ▶ if(!defined($case)){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $case) 0 0 0
95 0 return 0;
96 }
97 0 $self->{'_case'} = $case;
98 0 return 1;
99 }
100  
101 sub case {
102 0 ▶ my $self = shift;
Subroutine case: not called CC=1 SCAR=6.9
Pod documented
103 0 return $self->{'_case'};
104 }
105  
106 6 1;
107  
108 __END__
« Firemen/Load.pm ↑ Summary Firemen.pm »