File Coverage

blib/lib/CAD/Firemen/Option/Check.pm
Criterion Covered Total %
statement 9 44 20.4
branch 0 12 0.0
condition n/a
subroutine 3 10 30.0
pod 7 7 100.0
total 19 73 26.0


line stmt bran cond sub pod time code
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 .
18             #
19             ######################
20              
21 1     1   4 use strict;
  1         2  
  1         20  
22 1     1   5 use warnings;
  1         1  
  1         46  
23              
24             # Pod::Weaver infos
25             # ABSTRACT: An option check error
26              
27             package CAD::Firemen::Option::Check;
28             {
29             $CAD::Firemen::Option::Check::VERSION = '0.7.2';
30             }
31 1     1   4 use Exporter 'import';
  1         2  
  1         296  
32              
33             sub new {
34 0     0 1   my ($class) = shift;
35 0           my (%params) = @_;
36              
37             # check parameters
38 0 0         if(!exists($params{"name"})){
39 0           $params{"name"} = "";
40             }
41             #if(!exists($params{"line"})){
42             # $params{"line"} = "";
43             #}
44 0 0         if(!exists($params{"errorString"})){
45 0           $params{"errorString"} = "";
46             }
47 0 0         if(!exists($params{"case"})){
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     0 1   my $self = shift;
63 0           my $name = shift;
64 0 0         if(!defined($name)){
65 0           return 0;
66             }
67 0           $self->{'_option'} = $name;
68 0           return 1;
69             }
70              
71             sub option {
72 0     0 1   my $self = shift;
73 0           return $self->{'_option'};
74             }
75              
76             sub setErrorString {
77 0     0 1   my $self = shift;
78 0           my $string = shift;
79 0 0         if(!defined($string)){
80 0           return 0;
81             }
82 0           $self->{'_errorString'} = $string;
83 0           return 1;
84             }
85              
86             sub errorString {
87 0     0 1   my $self = shift;
88 0           return $self->{'_errorString'};
89             }
90              
91             sub setCase {
92 0     0 1   my $self = shift;
93 0           my $case = shift;
94 0 0         if(!defined($case)){
95 0           return 0;
96             }
97 0           $self->{'_case'} = $case;
98 0           return 1;
99             }
100              
101             sub case {
102 0     0 1   my $self = shift;
103 0           return $self->{'_case'};
104             }
105              
106             1;
107              
108             __END__