| 1 | package DBIx::CodeKit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use vars qw( $VERSION ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | $VERSION = '1.07'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | =head1 NAME | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | DBIx::CodeKit - Universal Code Table Interface | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 SYNOPSIS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | use DBIx::CodeKit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | my $ck = new DBIx::CodeKit($dbh, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | table => 'ck_code', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | getparam => sub { $cgi->param(shift) }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | getparams => sub { $cgi->param(shift.'[]') } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | =cut | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ### See the rest of the pod documentation at the end of this file. ### | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub new { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | my $dbh = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $args = ref($_[0]) ? shift : { @_ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $self = {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | bless $self, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | croak 'DBIx::CodeKit->new($dbh): $dbh is not an object' unless ref $dbh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | $self->{dbh} = $dbh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | $self->{table} = $args->{table} || 'ck_code'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args->{'table'} || 'ck_code'
MC/DC0%0/1
$args->{'table'} || 'ck_code'
$args->{'table'}
Truth table0%0/2
A
A= $args->{'table'}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | $self->{getparam} = $args->{getparam}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | $self->{getparams} = $args->{getparams}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | return $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # # # HTML display methods. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub desc { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | return &htmlspecialchars( $self->data(@_) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub ucfirst { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ucfirst: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | return CORE::ucfirst( $self->desc(@_) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub ucwords { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ucwords: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | my $str = $self->desc(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $str =~ s/(^|\s)([a-z])/$1\u$2/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | return $str; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # # # Data methods. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | sub data { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data: not called CC=3 SCAR=24.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my $code_set = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $code_code = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $code_code .= ''; # DBI needs strings here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | $self->{data_sth} = $self->{dbh}->prepare(" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | select code_desc | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | from $self->{table} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | where code_set = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | and code_code = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | ") unless $self->{data_sth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $self->{data_sth}->execute($code_set, $code_code); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my $code_desc = $self->{data_sth}->fetchrow; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | $code_desc = '' unless defined $code_desc; # Avoid warnings. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | return $code_desc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # # # HTML select single value methods: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub select { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select: not called CC=16 SCAR=56.1
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my $code_set = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my $args = ref($_[0]) ? shift : { @_ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | my $var_name = $args->{var_name} || $code_set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args->{'var_name'} || $code_set
MC/DC0%0/2
$args->{'var_name'} || $code_set
$args->{'var_name'}
$code_set
Truth table0%0/3
A || B
A= $args->{'var_name'}B= $code_set
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my $value = $args->{value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my $default = $args->{default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my $subset = $args->{subset}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my $options = $args->{options}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my $select_prompt = $args->{select_prompt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my $blank_prompt = $args->{blank_prompt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # Variable setup. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $value = $self->_getparam($var_name, $value, $default); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $Subset = &keyme($subset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | $options = $options ? " $options" : ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $select_prompt = '' unless defined $select_prompt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $blank_prompt = '' unless defined $blank_prompt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # Drop down box. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my $select = "<select name=\"$var_name\"$options>\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # Blank options. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $selected = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if ($value eq '') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | if ($select_prompt eq '') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $select_prompt = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | $self->ucwords('code_set', $code_set) . '?'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $select .= "<option value=\"\" selected>$select_prompt\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $selected = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } elsif ($blank_prompt ne '') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $select .= "<option value=\"\">$blank_prompt\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # Show code set options. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $set_list = $self->code_set($code_set); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | for my $row ( @$set_list ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my ($code_code, $code_desc) = @$row; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | next if ($Subset && !$Subset->{$code_code} && $code_code ne $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$Subset and not $Subset->{$code_code} and $code_code ne $value
$Subset and not $Subset->{$code_code}
MC/DC0%0/3
$Subset and not $Subset->{$code_code} and $code_code ne $value
$Subset
not $Subset->{$code_code}
$code_code ne $value
Truth table0%0/4
A and not(B) and C
A= $SubsetB= not $Subset->{$code_code}C= $code_code ne $value
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $code_desc = htmlspecialchars(CORE::ucfirst($code_desc)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | if ($code_code eq $value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $selected = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $select .= "<option value=\"$code_code\" selected>$code_desc\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } elsif ($row->[3] ne 'd') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $select .= "<option value=\"$code_code\">$code_desc\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # Show a missing value. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | if (!$selected) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $select .= "<option value=\"$value\" selected>$value\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $select .= "</select>\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | return $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | sub radio { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
radio: not called CC=19 SCAR=59.4
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my $code_set = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my $args = ref($_[0]) ? shift : { @_ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | my $var_name = $args->{var_name} || $code_set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args->{'var_name'} || $code_set
MC/DC0%0/2
$args->{'var_name'} || $code_set
$args->{'var_name'}
$code_set
Truth table0%0/3
A || B
A= $args->{'var_name'}B= $code_set
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $value = $args->{value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $default = $args->{default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my $subset = $args->{subset}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my $options = $args->{options}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $blank_prompt = $args->{blank_prompt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $sep = $args->{sep}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # Variable setup. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $value = $self->_getparam($var_name, $value, $default); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my $Subset = &keyme($subset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | $options = $options ? " $options" : ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | $blank_prompt = '' unless defined $blank_prompt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | $sep = "<br>\n" unless defined $sep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # Blank options. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $select = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $selected = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if ($value eq '') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $selected = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if ($blank_prompt ne '') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $select .= "<input type=\"radio\" name=\"$var_name\"$options"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $select .= " value=\"\" checked>$blank_prompt"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | if ($blank_prompt ne '') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $select .= "<input type=\"radio\" name=\"$var_name\"$options"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $select .= " value=\"\">$blank_prompt"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # Show code set options. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my $set_list = $self->code_set($code_set); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | for my $row ( @$set_list ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my ($code_code, $code_desc) = @$row; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | next if ($Subset && !$Subset->{$code_code} && $code_code ne $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$Subset and not $Subset->{$code_code} and $code_code ne $value
$Subset and not $Subset->{$code_code}
MC/DC0%0/3
$Subset and not $Subset->{$code_code} and $code_code ne $value
$Subset
not $Subset->{$code_code}
$code_code ne $value
Truth table0%0/4
A and not(B) and C
A= $SubsetB= not $Subset->{$code_code}C= $code_code ne $value
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $code_desc = htmlspecialchars(CORE::ucfirst($code_desc)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | if ( $code_code eq $value ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $selected = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | $select .= $sep if $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $select .= "<input type=\"radio\" name=\"$var_name\"$options"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $select .= " value=\"$code_code\" checked>$code_desc"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } elsif ($row->[3] ne 'd') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | $select .= $sep if $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $select .= "<input type=\"radio\" name=\"$var_name\"$options"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $select .= " value=\"$code_code\">$code_desc"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # Show missing values. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if (!$selected) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | $select .= $sep if $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $select .= "<input type=\"radio\" name=\"$var_name\"$options"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $select .= " value=\"$value\" checked>$value"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | return $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # # # HTML select multiple value methods: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | sub multiple { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
multiple: not called CC=12 SCAR=50.5
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $code_set = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | my $args = ref($_[0]) ? shift : { @_ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | my $var_name = $args->{var_name} || $code_set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args->{'var_name'} || $code_set
MC/DC0%0/2
$args->{'var_name'} || $code_set
$args->{'var_name'}
$code_set
Truth table0%0/3
A || B
A= $args->{'var_name'}B= $code_set
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my $value = $args->{value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | my $default = $args->{default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $subset = $args->{subset}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $options = $args->{options}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my $size = $args->{size}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # Variable setup. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $Value = $self->_getparams($var_name, $value, $default); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $Subset = &keyme($subset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | $options = $options ? " $options" : ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # Select multiple box. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $select = "<select multiple name=\"$var_name"."[]\"$options"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | $select .= " size=\"$size\"" if ($size); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $select .= ">\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | # Show code set options. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $set_list = $self->code_set($code_set); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | for my $row ( @$set_list ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my ($code_code, $code_desc) = @$row; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | next if ($Subset && !$Subset->{$code_code} && !$Value->{$code_code}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$Subset and not $Subset->{$code_code} and not $Value->{$code_code}
$Subset and not $Subset->{$code_code}
MC/DC0%0/3
$Subset and not $Subset->{$code_code} and not $Value->{$code_code}
$Subset
not $Subset->{$code_code}
not $Value->{$code_code}
Truth table0%0/4
A and not(B) and not(C)
A= $SubsetB= not $Subset->{$code_code}C= not $Value->{$code_code}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $code_desc = htmlspecialchars(CORE::ucfirst($code_desc)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | if ( $Value->{$code_code} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $select .= "<option value=\"$code_code\" selected>$code_desc\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | delete $Value->{$code_code}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } elsif ($row->[3] ne 'd') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | $select .= "<option value=\"$code_code\">$code_desc\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | # Show missing values. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | for my $code_code ( keys %$Value ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | $select .= "<option value=\"$code_code\" selected>$code_code\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $select .= "</select>\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | return $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | sub checkbox { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkbox: not called CC=15 SCAR=54.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my $code_set = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | my $args = ref($_[0]) ? shift : { @_ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | my $var_name = $args->{var_name} || $code_set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args->{'var_name'} || $code_set
MC/DC0%0/2
$args->{'var_name'} || $code_set
$args->{'var_name'}
$code_set
Truth table0%0/3
A || B
A= $args->{'var_name'}B= $code_set
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $value = $args->{value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my $default = $args->{default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | my $subset = $args->{subset}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my $options = $args->{options}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my $sep = $args->{sep}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # Variable setup. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | my $Value = $self->_getparams($var_name, $value, $default); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $Subset = &keyme($subset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | $options = $options ? " $options" : ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | $sep = "<br>\n" unless defined $sep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # Show code set options. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | my $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | my $set_list = $self->code_set($code_set); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | for my $row ( @$set_list ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | my ($code_code, $code_desc) = @$row; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | next if ($Subset && !$Subset->{$code_code} && !$Value->{$code_code}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$Subset and not $Subset->{$code_code} and not $Value->{$code_code}
$Subset and not $Subset->{$code_code}
MC/DC0%0/3
$Subset and not $Subset->{$code_code} and not $Value->{$code_code}
$Subset
not $Subset->{$code_code}
not $Value->{$code_code}
Truth table0%0/4
A and not(B) and not(C)
A= $SubsetB= not $Subset->{$code_code}C= not $Value->{$code_code}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $code_desc = htmlspecialchars(CORE::ucfirst($code_desc)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | if ( $Value->{$code_code} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | $select .= $sep if $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $select .= "<input type=\"checkbox\" name=\"$var_name"."[]\""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $select .= "$options value=\"$code_code\" checked>$code_desc"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | delete $Value->{$code_code}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } elsif ($row->[3] ne 'd') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | $select .= $sep if $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $select .= "<input type=\"checkbox\" name=\"$var_name"."[]\""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $select .= "$options value=\"$code_code\">$code_desc"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # Show missing values. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | for my $code_code ( keys %$Value ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | $select .= $sep if $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | $select .= "<input type=\"checkbox\" name=\"$var_name"."[]\""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | $select .= "$options value=\"$code_code\" checked>$code_code"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | return $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # # # Code Set Methods. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | sub code_set { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
code_set: not called CC=2 SCAR=17.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | my $code_set = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | $self->{set_sth} = $self->{dbh}->prepare(" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | select code_code, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | code_desc, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | code_order, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | code_flag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | from $self->{table} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | where code_set = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | order by code_order, code_code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | ") unless $self->{set_sth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $self->{set_sth}->execute($code_set); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | return $self->{set_sth}->fetchall_arrayref; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | # # # Code Table Updates. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub remove { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove: not called CC=2 SCAR=17.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my $code_set = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $code_code = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $code_code .= ''; # DBI needs strings here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | $self->{remove_sth} = $self->{dbh}->prepare(" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | delete from $self->{table} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | where code_set = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | and code_code = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | ") unless $self->{remove_sth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | $self->{remove_sth}->execute($code_set, $code_code); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | sub get { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=2 SCAR=17.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | my $code_set = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my $code_code = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | $self->{get_sth} = $self->{dbh}->prepare(" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | select code_desc, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | code_order, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | code_flag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | from $self->{table} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | where code_set = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | and code_code = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | ") unless $self->{get_sth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | $self->{get_sth}->execute($code_set, $code_code); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my @info = $self->{get_sth}->fetchrow_array; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | return @info; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | sub put { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put: not called CC=11 SCAR=47.1
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | my $code_set = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | my $code_code = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my $code_desc = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | my $code_order = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | my $code_flag = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | # Get the existing code info, if any. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | my @old = $self->get($code_set, $code_code); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | # Field work. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $code_code .= ''; # DBI needs strings here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $code_desc .= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | if (!@old and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
not @old and !defined($code_order) || $code_order eq "" and $code_code =~ /^\d+$/
not @old and !defined($code_order) || $code_order eq ""
not defined $code_order or $code_order eq ""
MC/DC0%0/4
not @old and !defined($code_order) || $code_order eq "" and $code_code =~ /^\d+$/
not @old
not defined $code_order
$code_order eq ""
$code_code =~ /^\d+$/
Truth table0%0/6
not(A) and not(B) or C and D
A= not @oldB= not defined $code_orderC= $code_order eq ""D= $code_code =~ /^\d+$/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | ( not defined($code_order) or $code_order eq '' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | and $code_code =~ /^\d+$/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | $code_order = $code_code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | { # Argument "" isn't numeric in int. Isn't that int's job? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | no warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $code_order = int($code_order); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | $code_flag .= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | # Make it so: add, update, or delete. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | if (@old) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | my ( $old_desc, $old_order, $old_flag ) = @old; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | if ($code_desc ne '') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | if ($code_desc ne $old_desc || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$code_desc ne $old_desc or $code_order ne $old_order or $code_flag ne $old_flag
$code_desc ne $old_desc or $code_order ne $old_order
MC/DC0%0/3
$code_desc ne $old_desc or $code_order ne $old_order or $code_flag ne $old_flag
$code_desc ne $old_desc
$code_order ne $old_order
$code_flag ne $old_flag
Truth table0%0/4
A or B or C
A= $code_desc ne $old_descB= $code_order ne $old_orderC= $code_flag ne $old_flag
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | $code_order ne $old_order || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | $code_flag ne $old_flag) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $self->_update($code_set, $code_code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | $code_desc, $code_order, $code_flag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $self->remove($code_set, $code_code); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | elsif ($code_desc ne '') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $self->_insert($code_set, $code_code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | $code_desc, $code_order, $code_flag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # # # Private methods. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | sub _insert { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_insert: not called CC=2 SCAR=17.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | $self->{insert_sth} = $self->{dbh}->prepare(" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | insert into $self->{table} set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | code_set = ?, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | code_code = ?, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | code_desc = ?, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | code_order = ?, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | code_flag = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | ") unless $self->{insert_sth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $self->{insert_sth}->execute(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | sub _update { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_update: not called CC=2 SCAR=17.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my $code_set = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | my $code_code = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | my $code_desc = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | my $code_order = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | my $code_flag = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | $self->{update_sth} = $self->{dbh}->prepare(" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | update $self->{table} set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | code_desc = ?, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | code_order = ?, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | code_flag = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | where code_set = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | and code_code = ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | ") unless $self->{update_sth}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | $self->{update_sth}->execute( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $code_desc, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | $code_order, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | $code_flag, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | $code_set, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | $code_code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | sub _getparam { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_getparam: not called CC=5 SCAR=34.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | my $var_name = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | my $value = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | my $default = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | ▶ | if ( not defined $value ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | if ( $self->{getparam} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | $value = &{$self->{getparam}}($var_name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | $value = $default unless defined $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | $value = '' unless defined $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | return $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | sub _getparams { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_getparams: not called CC=8 SCAR=42.8
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | my $var_name = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | my $value = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | my $default = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | if ( not defined $value ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | my $call = $self->{getparams} ? $self->{getparams} : $self->{getparam}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | if ( $call ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | $value = [ grep { defined $_ } &$call($var_name) ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | $value = $value->[0] if ref $value->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | $value = $default unless defined $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | $value = '' unless defined $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | ▶ | return &keyme($value) || {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
&keyme($value) || {}
MC/DC0%0/1
&keyme($value) || {}
&keyme($value)
Truth table0%0/2
A
A= &keyme($value)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | sub keyme { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
keyme: not called CC=7 SCAR=40.3
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | my $value = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | return $value if ref($value) eq 'HASH'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | my $Keyhash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | if (ref($value) eq 'ARRAY') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | for my $val ( @$value ) { $Keyhash->{$val} = 1; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | ▶ | } elsif (defined($value) && $value ne '' && !ref($value)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
defined $value and $value ne "" and not ref $value
defined $value and $value ne ""
MC/DC0%0/3
defined $value and $value ne "" and not ref $value
defined $value
$value ne ""
not ref $value
Truth table0%0/4
A and B and not(C)
A= defined $valueB= $value ne ""C= not ref $value
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | $Keyhash->{$value} = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | return $Keyhash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | sub htmlspecialchars { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
htmlspecialchars: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | my $str = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | $str =~ s/&/\&/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | $str =~ s/"/\"/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | $str =~ s/</\</g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | $str =~ s/>/\>/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | return $str; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 1 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | __END__ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||