| 1 | package Net::DSML::Control; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | #use Carp; | ||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Class::Std::Utils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | # Copyright (c) 2007 Clif Harden <charden@pobox.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 9 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||
| 10 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use version; $VERSION = version->new('0.002'); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | { | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | BEGIN | ||||||||||||||||||||||||||||
| 18 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use Exporter (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 3 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 22 | 3 | @EXPORT = qw(); | |||||||||||||||||||||||||||
| 23 | 3 | %EXPORT_TAGS = (); | |||||||||||||||||||||||||||
| 24 | 3 | @EXPORT_OK = (); | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 3 | my %errMsg; # no error this will be a null string. | |||||||||||||||||||||||||||
| 28 | my %controls; # Actual xml data string. | ||||||||||||||||||||||||||||
| 29 | 3 | my %default; # will contain the initial control string if there is one. | |||||||||||||||||||||||||||
| 30 | # | ||||||||||||||||||||||||||||
| 31 | # Method new | ||||||||||||||||||||||||||||
| 32 | # | ||||||||||||||||||||||||||||
| 33 | # The method new creates a new DSML Control oject. | ||||||||||||||||||||||||||||
| 34 | # | ||||||||||||||||||||||||||||
| 35 | # There are four possible input options. | ||||||||||||||||||||||||||||
| 36 | # Input option "control": Sets the oid number of the control | ||||||||||||||||||||||||||||
| 37 | # Input option "value": Sets the control value data. | ||||||||||||||||||||||||||||
| 38 | # Input option "valuetype": Sets the xsd type for the control value. | ||||||||||||||||||||||||||||
| 39 | # Input option "criticality": Sets the criticality variable to the input | ||||||||||||||||||||||||||||
| 40 | # value, either true or false. | ||||||||||||||||||||||||||||
| 41 | # | ||||||||||||||||||||||||||||
| 42 | # | ||||||||||||||||||||||||||||
| 43 | # $control = Net::DSML::Control->new( { control => 1.2.840.113556.1.4.619, | ||||||||||||||||||||||||||||
| 44 | # valuetype => base64Binary, | ||||||||||||||||||||||||||||
| 45 | # criticality => true, | ||||||||||||||||||||||||||||
| 46 | # value => RFNNTYyLJA== } ); | ||||||||||||||||||||||||||||
| 47 | # | ||||||||||||||||||||||||||||
| 48 | # Method output; Returns a new DSML object. | ||||||||||||||||||||||||||||
| 49 | # | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | sub new | ||||||||||||||||||||||||||||
| 52 | 19 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=26 SCAR=35.1
Pod
documented
| |||||||||||||||||||||||||||||
| 53 | 19 | my ($class, $opt) = @_; | |||||||||||||||||||||||||||
| 54 | 19 | my $self = bless anon_scalar(),$class; | |||||||||||||||||||||||||||
| 55 | 19 | my $id = ident($self); | |||||||||||||||||||||||||||
| 56 | 19 | my $result; | |||||||||||||||||||||||||||
| 57 | my $value; | ||||||||||||||||||||||||||||
| 58 | 19 | my $valuetype; | |||||||||||||||||||||||||||
| 59 | 19 | my $criticality; | |||||||||||||||||||||||||||
| 60 | 19 | my $control; | |||||||||||||||||||||||||||
| 61 | # | ||||||||||||||||||||||||||||
| 62 | # Initailize data to a default values. | ||||||||||||||||||||||||||||
| 63 | # | ||||||||||||||||||||||||||||
| 64 | 19 | $errMsg{$id} = ""; # no error | |||||||||||||||||||||||||||
| 65 | 19 | $controls{$id} = []; # Actual control xml data string(s). | |||||||||||||||||||||||||||
| 66 | 19 | $default{$id}->{default} = ""; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 19 | ▶ | if ( $opt ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 12 | ▶ | if ( !defined($opt->{control}) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | { | ||||||||||||||||||||||||||||
| 73 | 0 | $errMsg{$id} = "Subroutine Control required type oid value is not defined."; | |||||||||||||||||||||||||||
| 74 | 0 | return $self; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 12 | ▶ | $control = (ref($opt->{control}) ? ${$opt->{control}} : $opt->{control}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 12 | ▶ | $valuetype = (ref($opt->{valuetype}) ? ${$opt->{valuetype}} : $opt->{valuetype}) if ( $opt->{valuetype}); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 79 | 12 | ▶ | $criticality = (ref($opt->{criticality}) ? ${$opt->{criticality}} : $opt->{criticality}) if ( $opt->{criticality}); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 80 | 12 | ▶ | $value = (ref($opt->{value}) ? ${$opt->{value}} : $opt->{value}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 12 | ▶ | if ( $opt->{criticality} && !($criticality =~ /^(true)||(false)$/) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"criticality"} and not $criticality =~ /^(true)||(false)$/
MC/DC0%0/2
$opt->{"criticality"} and not $criticality =~ /^(true)||(false)$/
$opt->{"criticality"}
not $criticality =~ /^(true)||(false)$/
Truth table66%2/3
A and not(B)
A= $opt->{"criticality"}B= not $criticality =~ /^(true)||(false)$/
| |||||||||||||||||||||||||||||
| 83 | { | ||||||||||||||||||||||||||||
| 84 | 0 | $errMsg{$id} = "The Control`s criticality is not defined properly."; | |||||||||||||||||||||||||||
| 85 | 0 | return $self; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 12 | ▶ | if ( $opt->{valuetype} && !($valuetype =~ /^(string)||(anyURI)||(base64Binary)$/) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"valuetype"} and not $valuetype =~ /^(string)||(anyURI)||(base64Binary)$/
MC/DC0%0/2
$opt->{"valuetype"} and not $valuetype =~ /^(string)||(anyURI)||(base64Binary)$/
$opt->{"valuetype"}
not $valuetype =~ /^(string)||(anyURI)||(base64Binary)$/
Truth table66%2/3
A and not(B)
A= $opt->{"valuetype"}B= not $valuetype =~ /^(string)||(anyURI)||(base64Binary)$/
| |||||||||||||||||||||||||||||
| 89 | { | ||||||||||||||||||||||||||||
| 90 | 0 | $errMsg{$id} = "The Control`s valuetype is not defined properly."; | |||||||||||||||||||||||||||
| 91 | 0 | return $self; | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 12 | ▶ | if ( $opt->{value} && !$opt->{valuetype}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"value"} and not $opt->{"valuetype"}
MC/DC0%0/2
$opt->{"value"} and not $opt->{"valuetype"}
$opt->{"value"}
not $opt->{"valuetype"}
Truth table66%2/3
A and not(B)
A= $opt->{"value"}B= not $opt->{"valuetype"}
| |||||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||
| 96 | 0 | $errMsg{$id} = "The value data was defined but the valuetype of the value data was not not defined."; | |||||||||||||||||||||||||||
| 97 | 0 | return $self; | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 12 | ▶ | if ( $opt->{type} && !$opt->{value}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$opt->{"type"} and not $opt->{"value"}
MC/DC0%0/2
$opt->{"type"} and not $opt->{"value"}
$opt->{"type"}
not $opt->{"value"}
Truth table33%1/3
A and not(B)
A= $opt->{"type"}B= not $opt->{"value"}
| |||||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||
| 102 | 0 | $errMsg{$id} = "The valuetype was defined but the value data was not not defined."; | |||||||||||||||||||||||||||
| 103 | 0 | return $self; | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 12 | ▶ | if ( $opt->{value} ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||
| 108 | 5 | ▶ | _specialChar(\$value) if ( $value =~ /(&||<||>||"||')/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 12 | $result = "<control type=\"". $control . "\""; | |||||||||||||||||||||||||||
| 112 | 12 | ▶ | $result .= " critical=\"" . $criticality . "\"" if ( $opt->{criticality}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 12 | $result .= ">"; | |||||||||||||||||||||||||||
| 114 | 12 | ▶ | $result .= "<controlValue " if ($opt->{value}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | 12 | ▶ | $result .= "xsi:type=\"xsd:" . $valuetype . "\"" if ( $opt->{value} && $opt->{valuetype}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"value"} and $opt->{"valuetype"}
MC/DC50%1/2
$opt->{"value"} and $opt->{"valuetype"}
$opt->{"value"}
$opt->{"valuetype"}
Truth table66%2/3
A and B
A= $opt->{"value"}B= $opt->{"valuetype"}
| |||||||||||||||||||||||||||||
| 116 | 12 | ▶ | $result .= ">" if ( $opt->{value} && $opt->{valuetype}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"value"} and $opt->{"valuetype"}
MC/DC50%1/2
$opt->{"value"} and $opt->{"valuetype"}
$opt->{"value"}
$opt->{"valuetype"}
Truth table66%2/3
A and B
A= $opt->{"value"}B= $opt->{"valuetype"}
| |||||||||||||||||||||||||||||
| 117 | 12 | ▶ | $result .= $value . "</controlValue>" if ($opt->{value}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | 12 | $result .= "</control>"; | |||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 12 | push(@{$controls{$id}}, $result); | |||||||||||||||||||||||||||
| 121 | 12 | $default{$id}->{default} = $result; | |||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 19 | return $self; | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | # | ||||||||||||||||||||||||||||
| 128 | # inside-out classes have to have a DESTROY subrountine. | ||||||||||||||||||||||||||||
| 129 | # | ||||||||||||||||||||||||||||
| 130 | sub DESTROY | ||||||||||||||||||||||||||||
| 131 | 19 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 132 | 19 | my ($dsml) = @_; | |||||||||||||||||||||||||||
| 133 | 19 | my $id = ident($dsml); | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 19 | delete $controls{$id}; # Copy of actual xml data string. | |||||||||||||||||||||||||||
| 136 | 19 | delete $default{$id}; # Copy of actual xml data string. | |||||||||||||||||||||||||||
| 137 | 19 | delete $errMsg{$id}; # no error this will be a null string. | |||||||||||||||||||||||||||
| 138 | 19 | return; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | # | ||||||||||||||||||||||||||||
| 142 | # The method clear sets object variables to their default values. | ||||||||||||||||||||||||||||
| 143 | # | ||||||||||||||||||||||||||||
| 144 | # Returns true on success. | ||||||||||||||||||||||||||||
| 145 | # | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | sub clear | ||||||||||||||||||||||||||||
| 148 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
clear: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 149 | 1 | my ($dsml) = shift; | |||||||||||||||||||||||||||
| 150 | 1 | my $id = ident $dsml; | |||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 1 | $controls{$id} = []; # Actual xml data string. | |||||||||||||||||||||||||||
| 153 | 1 | $errMsg{$id} = ""; # error messages, no error this will be a null string. | |||||||||||||||||||||||||||
| 154 | 1 | push(@{$controls{$id}}, $default{$id}->{default}); | |||||||||||||||||||||||||||
| 155 | 1 | return 1; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | # 1. & - & | ||||||||||||||||||||||||||||
| 159 | # 2. < - < | ||||||||||||||||||||||||||||
| 160 | # 3. > - > | ||||||||||||||||||||||||||||
| 161 | # 4. " - " | ||||||||||||||||||||||||||||
| 162 | # 5. ' - ' | ||||||||||||||||||||||||||||
| 163 | # | ||||||||||||||||||||||||||||
| 164 | # Convert special characters to xml standards. | ||||||||||||||||||||||||||||
| 165 | # | ||||||||||||||||||||||||||||
| 166 | sub _specialChar | ||||||||||||||||||||||||||||
| 167 | 8 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_specialChar: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 168 | 8 | my ($char) = @_; | |||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 8 | $$char =~ s/&/&/g; | |||||||||||||||||||||||||||
| 171 | 8 | $$char =~ s/</</g; | |||||||||||||||||||||||||||
| 172 | 8 | $$char =~ s/>/>/g; | |||||||||||||||||||||||||||
| 173 | 8 | $$char =~ s/"/"/g; | |||||||||||||||||||||||||||
| 174 | 8 | $$char =~ s/'/'/g; | |||||||||||||||||||||||||||
| 175 | 8 | return; | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | # | ||||||||||||||||||||||||||||
| 179 | # Method error | ||||||||||||||||||||||||||||
| 180 | # | ||||||||||||||||||||||||||||
| 181 | # The method error returns the error message for the object. | ||||||||||||||||||||||||||||
| 182 | # $message = $dsml->error(); | ||||||||||||||||||||||||||||
| 183 | # | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | sub error | ||||||||||||||||||||||||||||
| 186 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 187 | 0 | my $dsml = shift; | |||||||||||||||||||||||||||
| 188 | 0 | return $errMsg{ident $dsml}; | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | # Method add | ||||||||||||||||||||||||||||
| 192 | # | ||||||||||||||||||||||||||||
| 193 | # The method Add is used in conjuction with other methods like Search. | ||||||||||||||||||||||||||||
| 194 | # | ||||||||||||||||||||||||||||
| 195 | # If there is one required input option and 3 additional optional options. | ||||||||||||||||||||||||||||
| 196 | # | ||||||||||||||||||||||||||||
| 197 | # $return = $control->Add( { control => 1.2.840.113556.1.4.619, valuetype => base64Binary, criticality => true, value => RFNNTYyLJA== } ); | ||||||||||||||||||||||||||||
| 198 | # | ||||||||||||||||||||||||||||
| 199 | # Input option "control": The control oid number. | ||||||||||||||||||||||||||||
| 200 | # Input option "valuetype": The xsd type for the value data. | ||||||||||||||||||||||||||||
| 201 | # Input option "criticality": The criticality of the control; true or false. | ||||||||||||||||||||||||||||
| 202 | # Input option "value": The value of the control. | ||||||||||||||||||||||||||||
| 203 | # | ||||||||||||||||||||||||||||
| 204 | # Method output; Returns true on success; false on error, error message | ||||||||||||||||||||||||||||
| 205 | # can be gotten with error method. | ||||||||||||||||||||||||||||
| 206 | # | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | sub add | ||||||||||||||||||||||||||||
| 209 | 8 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
add: called CC=25 SCAR=37.7
Pod
documented
| |||||||||||||||||||||||||||||
| 210 | 8 | my ($dsml, $opt) = @_; | |||||||||||||||||||||||||||
| 211 | 8 | my $id = ident $dsml; | |||||||||||||||||||||||||||
| 212 | 8 | my $result; | |||||||||||||||||||||||||||
| 213 | my $value; | ||||||||||||||||||||||||||||
| 214 | 8 | my $valuetype; | |||||||||||||||||||||||||||
| 215 | 8 | my $criticality; | |||||||||||||||||||||||||||
| 216 | 8 | my $control; | |||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 8 | $errMsg{$id} = ""; | |||||||||||||||||||||||||||
| 219 | 8 | ▶ | if ( !defined($opt->{control}) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 220 | { | ||||||||||||||||||||||||||||
| 221 | 0 | $errMsg{$id} = "Method add control required oid value is not defined."; | |||||||||||||||||||||||||||
| 222 | 0 | return 0; | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | 0 | ▶ | $control = (ref($opt->{control}) ? ${$opt->{control}} : $opt->{control}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | 0 | ▶ | $valuetype = (ref($opt->{valuetype}) ? ${$opt->{valuetype}} : $opt->{valuetype}) if ( $opt->{valuetype}); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 227 | 0 | ▶ | $criticality = (ref($opt->{criticality}) ? ${$opt->{criticality}} : $opt->{criticality}) if ( $opt->{criticality}); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | $value = (ref($opt->{value}) ? ${$opt->{value}} : $opt->{value}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 8 | ▶ | if ( $opt->{criticality} && !($criticality =~ /^(true)||(false)$/) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"criticality"} and not $criticality =~ /^(true)||(false)$/
MC/DC0%0/2
$opt->{"criticality"} and not $criticality =~ /^(true)||(false)$/
$opt->{"criticality"}
not $criticality =~ /^(true)||(false)$/
Truth table66%2/3
A and not(B)
A= $opt->{"criticality"}B= not $criticality =~ /^(true)||(false)$/
| |||||||||||||||||||||||||||||
| 232 | { | ||||||||||||||||||||||||||||
| 233 | 0 | $errMsg{$id} = "Method add Control criticality is not defined properly."; | |||||||||||||||||||||||||||
| 234 | 0 | return 0; | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 8 | ▶ | if ( $opt->{valuetype} && !($valuetype =~ /^(string)||(anyURI)||(base64Binary)$/) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"valuetype"} and not $valuetype =~ /^(string)||(anyURI)||(base64Binary)$/
MC/DC0%0/2
$opt->{"valuetype"} and not $valuetype =~ /^(string)||(anyURI)||(base64Binary)$/
$opt->{"valuetype"}
not $valuetype =~ /^(string)||(anyURI)||(base64Binary)$/
Truth table66%2/3
A and not(B)
A= $opt->{"valuetype"}B= not $valuetype =~ /^(string)||(anyURI)||(base64Binary)$/
| |||||||||||||||||||||||||||||
| 238 | { | ||||||||||||||||||||||||||||
| 239 | 0 | $errMsg{$id} = "Method add control`s valuetype is not defined properly."; | |||||||||||||||||||||||||||
| 240 | 0 | return 0; | |||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | 8 | ▶ | if ( $opt->{value} && ! $opt->{valuetype}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"value"} and not $opt->{"valuetype"}
MC/DC0%0/2
$opt->{"value"} and not $opt->{"valuetype"}
$opt->{"value"}
not $opt->{"valuetype"}
Truth table66%2/3
A and not(B)
A= $opt->{"value"}B= not $opt->{"valuetype"}
| |||||||||||||||||||||||||||||
| 244 | { | ||||||||||||||||||||||||||||
| 245 | 0 | $errMsg{$id} = "Method control valuetype for the value data was not not defined."; | |||||||||||||||||||||||||||
| 246 | 0 | return 0; | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 8 | ▶ | if ( $opt->{valuetype} && !$opt->{value}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"valuetype"} and not $opt->{"value"}
MC/DC0%0/2
$opt->{"valuetype"} and not $opt->{"value"}
$opt->{"valuetype"}
not $opt->{"value"}
Truth table66%2/3
A and not(B)
A= $opt->{"valuetype"}B= not $opt->{"value"}
| |||||||||||||||||||||||||||||
| 250 | { | ||||||||||||||||||||||||||||
| 251 | 0 | $errMsg{$id} = "Method add control`s valuetype was defined but the value data was not not defined."; | |||||||||||||||||||||||||||
| 252 | 0 | return 0; | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 8 | ▶ | if ( $opt->{value} ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | { | ||||||||||||||||||||||||||||
| 257 | 3 | ▶ | _specialChar(\$value) if ( $value =~ /(&||<||>||"||')/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 8 | $result = "<control type=\"". $control . "\""; | |||||||||||||||||||||||||||
| 261 | 8 | ▶ | $result .= " critical=\"" . $criticality . "\"" if ( $opt->{criticality}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 262 | 8 | $result .= ">"; | |||||||||||||||||||||||||||
| 263 | 8 | ▶ | $result .= "<controlValue " if ($opt->{value}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | 8 | ▶ | $result .= "xsi:type=\"xsd:" . $valuetype . "\"" if ( $opt->{value} && $opt->{valuetype}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"value"} and $opt->{"valuetype"}
MC/DC50%1/2
$opt->{"value"} and $opt->{"valuetype"}
$opt->{"value"}
$opt->{"valuetype"}
Truth table66%2/3
A and B
A= $opt->{"value"}B= $opt->{"valuetype"}
| |||||||||||||||||||||||||||||
| 265 | 8 | ▶ | $result .= ">" if ( $opt->{value} && $opt->{valuetype}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opt->{"value"} and $opt->{"valuetype"}
MC/DC50%1/2
$opt->{"value"} and $opt->{"valuetype"}
$opt->{"value"}
$opt->{"valuetype"}
Truth table66%2/3
A and B
A= $opt->{"value"}B= $opt->{"valuetype"}
| |||||||||||||||||||||||||||||
| 266 | 8 | ▶ | $result .= $value . "</controlValue>" if ($opt->{value}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | 8 | $result .= "</control>"; | |||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | 8 | push(@{$controls{$id}}, $result); | |||||||||||||||||||||||||||
| 270 | 8 | return 1; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | sub getControl | ||||||||||||||||||||||||||||
| 274 | 20 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
getControl: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 275 | 20 | my ($dsml) = @_; | |||||||||||||||||||||||||||
| 276 | 20 | my $id = ident $dsml; | |||||||||||||||||||||||||||
| 277 | 20 | my $result; | |||||||||||||||||||||||||||
| 278 | 20 | $result = ""; | |||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | 20 | foreach my $var (@{$controls{$id}}) | |||||||||||||||||||||||||||
| 281 | { | ||||||||||||||||||||||||||||
| 282 | 22 | $result .= $var; | |||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | 20 | return $result; | |||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 3 | 1; # Magic true value required at end of module | |||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | __END__ | ||||||||||||||||||||||||||||