| 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 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 11 | ▶ | 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 | 11 | $CAD::Firemen::Option::Check::VERSION = '0.7.2'; | |||||||||
| 30 | } | ||||||||||
| 31 | 11 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 32 | |||||||||||
| 33 | 8 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 34 | 8 | my ($class) = shift; | |||||||||
| 35 | 8 | my (%params) = @_; | |||||||||
| 36 | |||||||||||
| 37 | # check parameters | ||||||||||
| 38 | 8 | ▶ | if(!exists($params{"name"})){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 1 | $params{"name"} = ""; | |||||||||
| 40 | } | ||||||||||
| 41 | #if(!exists($params{"line"})){ | ||||||||||
| 42 | # $params{"line"} = ""; | ||||||||||
| 43 | #} | ||||||||||
| 44 | 8 | ▶ | if(!exists($params{"errorString"})){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 1 | $params{"errorString"} = ""; | |||||||||
| 46 | } | ||||||||||
| 47 | 8 | ▶ | if(!exists($params{"case"})){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | 3 | $params{"case"} = 0; | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | my $self = { | ||||||||||
| 52 | '_option' => $params{"name"}, | ||||||||||
| 53 | #'_line' => $params{"line"} | ||||||||||
| 54 | '_errorString' => $params{"errorString"}, | ||||||||||
| 55 | 8 | '_case' => $params{"case"} | |||||||||
| 56 | }; | ||||||||||
| 57 | 8 | bless $self, $class; | |||||||||
| 58 | 8 | return $self; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 2 | ▶ | sub setOption { | ||||||||
|
Subroutine
setOption: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 62 | 2 | my $self = shift; | |||||||||
| 63 | 2 | my $name = shift; | |||||||||
| 64 | 2 | ▶ | if(!defined($name)){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | 1 | return 0; | |||||||||
| 66 | } | ||||||||||
| 67 | 1 | $self->{'_option'} = $name; | |||||||||
| 68 | 1 | return 1; | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 2 | ▶ | sub option { | ||||||||
|
Subroutine
option: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 72 | 2 | my $self = shift; | |||||||||
| 73 | 2 | return $self->{'_option'}; | |||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | 2 | ▶ | sub setErrorString { | ||||||||
|
Subroutine
setErrorString: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 77 | 2 | my $self = shift; | |||||||||
| 78 | 2 | my $string = shift; | |||||||||
| 79 | 2 | ▶ | if(!defined($string)){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | 1 | return 0; | |||||||||
| 81 | } | ||||||||||
| 82 | 1 | $self->{'_errorString'} = $string; | |||||||||
| 83 | 1 | return 1; | |||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | 4 | ▶ | sub errorString { | ||||||||
|
Subroutine
errorString: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 87 | 4 | my $self = shift; | |||||||||
| 88 | 4 | return $self->{'_errorString'}; | |||||||||
| 89 | } | ||||||||||
| 90 | |||||||||||
| 91 | 2 | ▶ | sub setCase { | ||||||||
|
Subroutine
setCase: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 92 | 2 | my $self = shift; | |||||||||
| 93 | 2 | my $case = shift; | |||||||||
| 94 | 2 | ▶ | if(!defined($case)){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 95 | 1 | return 0; | |||||||||
| 96 | } | ||||||||||
| 97 | 1 | $self->{'_case'} = $case; | |||||||||
| 98 | 1 | return 1; | |||||||||
| 99 | } | ||||||||||
| 100 | |||||||||||
| 101 | 8 | ▶ | sub case { | ||||||||
|
Subroutine
case: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 102 | 8 | my $self = shift; | |||||||||
| 103 | 8 | return $self->{'_case'}; | |||||||||
| 104 | } | ||||||||||
| 105 | |||||||||||
| 106 | 11 | 1; | |||||||||
| 107 | |||||||||||
| 108 | __END__ | ||||||||||