| 1 | package DBIx::BabelKit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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::BabelKit - Universal Multilingual Code Table Interface | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | use DBIx::BabelKit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | my $bk = new DBIx::BabelKit($dbh, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | table => 'bk_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=5 SCAR=34.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::BabelKit->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} || 'bk_code'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args->{'table'} || 'bk_code'
MC/DC0%0/1
$args->{'table'} || 'bk_code'
$args->{'table'}
Truth table0%0/2
A
A= $args->{'table'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | $self->{getparam} = $args->{getparam}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | $self->{getparams} = $args->{getparams}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $self->{native} = $self->_find_native; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | croak "DBIx::BabelKit::new: unable to determine native language" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | " Check table '$self->{table}' for code_admin/code_admin record." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | unless $self->{native}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # # # HTML display methods. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | sub desc { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desc: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | return &htmlspecialchars( $self->render(@_) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub ucfirst { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ucfirst: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | return CORE::ucfirst( $self->desc(@_) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub ucwords { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ucwords: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my $str = $self->desc(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $str =~ s/(^|\s)([a-z])/$1\u$2/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # # # Data methods. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub render { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $code_desc = $self->data(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | if ($code_desc eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $code_desc = $self->data($_[0], $self->{native}, $_[2]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if ($code_desc eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | $code_desc = $_[2] || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$_[2] || ''
MC/DC0%0/1
$_[2] || ''
$_[2]
Truth table0%0/2
A
A= $_[2]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | return $code_desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | sub data { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my $code_lang = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $code_code = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $code_code .= ''; # DBI needs strings here. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | $self->{data_sth} = $self->{dbh}->prepare(" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | select code_desc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | from $self->{table} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | where code_set = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | and code_lang = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | and code_code = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | ") unless $self->{data_sth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $self->{data_sth}->execute($code_set, $code_lang, $code_code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my $code_desc = $self->{data_sth}->fetchrow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | $code_desc = '' unless defined $code_desc; # Avoid warnings. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | return $code_desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub param { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
param: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | return $self->data($_[0], $self->{native}, $_[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # # # HTML select single value methods: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub select { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | my $code_lang = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | my $args = ref($_[0]) ? shift : { @_ }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $value = $args->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my $default = $args->{default}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my $subset = $args->{subset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my $options = $args->{options}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $select_prompt = $args->{select_prompt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my $blank_prompt = $args->{blank_prompt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # Variable setup. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $value = $self->_getparam($var_name, $value, $default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my $Subset = &keyme($subset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | $options = $options ? " $options" : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | $select_prompt = '' unless defined $select_prompt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | $blank_prompt = '' unless defined $blank_prompt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # Drop down box. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $select = "<select name=\"$var_name\"$options>\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # Blank options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my $selected = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | if ($value eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | if ($select_prompt eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $select_prompt = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | $self->ucwords('code_set', $code_lang, $code_set) . '?'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $select .= "<option value=\"\" selected>$select_prompt\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $selected = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } elsif ($blank_prompt ne '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $select .= "<option value=\"\">$blank_prompt\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # Show code set options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my $set_list = $self->full_set($code_set, $code_lang); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | for my $row ( @$set_list ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my ($code_code, $code_desc) = @$row; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $code_desc = htmlspecialchars(CORE::ucfirst($code_desc)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ($code_code eq $value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $selected = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $select .= "<option value=\"$code_code\" selected>$code_desc\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } elsif ($row->[3] ne 'd') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | $select .= "<option value=\"$code_code\">$code_desc\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # Show a missing value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | if (!$selected) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $select .= "<option value=\"$value\" selected>$value\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $select .= "</select>\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | return $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | sub radio { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
radio: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $code_lang = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | my $args = ref($_[0]) ? shift : { @_ }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my $value = $args->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | my $default = $args->{default}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $subset = $args->{subset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $options = $args->{options}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $blank_prompt = $args->{blank_prompt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my $sep = $args->{sep}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | # Variable setup. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $value = $self->_getparam($var_name, $value, $default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my $Subset = &keyme($subset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | $options = $options ? " $options" : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | $blank_prompt = '' unless defined $blank_prompt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | $sep = "<br>\n" unless defined $sep; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # Blank options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $select = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $selected = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if ($value eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $selected = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ($blank_prompt ne '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $select .= "<input type=\"radio\" name=\"$var_name\"$options"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $select .= " value=\"\" checked>$blank_prompt"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if ($blank_prompt ne '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $select .= "<input type=\"radio\" name=\"$var_name\"$options"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $select .= " value=\"\">$blank_prompt"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | # Show code set options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $set_list = $self->full_set($code_set, $code_lang); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | for my $row ( @$set_list ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my ($code_code, $code_desc) = @$row; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $code_desc = htmlspecialchars(CORE::ucfirst($code_desc)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if ( $code_code eq $value ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $selected = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | $select .= $sep if $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $select .= "<input type=\"radio\" name=\"$var_name\"$options"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $select .= " value=\"$code_code\" checked>$code_desc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } elsif ($row->[3] ne 'd') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | $select .= $sep if $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $select .= "<input type=\"radio\" name=\"$var_name\"$options"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $select .= " value=\"$code_code\">$code_desc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # Show missing values. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | if (!$selected) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $select .= $sep if $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $select .= "<input type=\"radio\" name=\"$var_name\"$options"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $select .= " value=\"$value\" checked>$value"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | return $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | # # # HTML select multiple value methods: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | sub multiple { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
multiple: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $code_lang = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | my $args = ref($_[0]) ? shift : { @_ }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $value = $args->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $default = $args->{default}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my $subset = $args->{subset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | my $options = $args->{options}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my $size = $args->{size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | # Variable setup. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my $Value = $self->_getparams($var_name, $value, $default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | my $Subset = &keyme($subset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | $options = $options ? " $options" : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | # Select multiple box. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $select = "<select multiple name=\"$var_name"."[]\"$options"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | $select .= " size=\"$size\"" if ($size); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $select .= ">\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | # Show code set options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $set_list = $self->full_set($code_set, $code_lang); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | for my $row ( @$set_list ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my ($code_code, $code_desc) = @$row; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 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}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $code_desc = htmlspecialchars(CORE::ucfirst($code_desc)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if ( $Value->{$code_code} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $select .= "<option value=\"$code_code\" selected>$code_desc\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | delete $Value->{$code_code}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } elsif ($row->[3] ne 'd') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | $select .= "<option value=\"$code_code\">$code_desc\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # Show missing values. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | for my $code_code ( keys %$Value ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $select .= "<option value=\"$code_code\" selected>$code_code\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | $select .= "</select>\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | return $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | sub checkbox { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkbox: not called CC=15 SCAR=54.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $code_lang = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | my $args = ref($_[0]) ? shift : { @_ }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my $value = $args->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my $default = $args->{default}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | my $subset = $args->{subset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my $options = $args->{options}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $sep = $args->{sep}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # Variable setup. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | my $Value = $self->_getparams($var_name, $value, $default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | my $Subset = &keyme($subset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | $options = $options ? " $options" : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | $sep = "<br>\n" unless defined $sep; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # Show code set options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | my $set_list = $self->full_set($code_set, $code_lang); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | for my $row ( @$set_list ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | my ($code_code, $code_desc) = @$row; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 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}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $code_desc = htmlspecialchars(CORE::ucfirst($code_desc)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | if ( $Value->{$code_code} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | $select .= $sep if $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | $select .= "<input type=\"checkbox\" name=\"$var_name"."[]\""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | $select .= "$options value=\"$code_code\" checked>$code_desc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | delete $Value->{$code_code}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } elsif ($row->[3] ne 'd') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | $select .= $sep if $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | $select .= "<input type=\"checkbox\" name=\"$var_name"."[]\""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $select .= "$options value=\"$code_code\">$code_desc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # Show missing values. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | for my $code_code ( keys %$Value ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | $select .= $sep if $select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | $select .= "<input type=\"checkbox\" name=\"$var_name"."[]\""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | $select .= "$options value=\"$code_code\" checked>$code_code"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | return $select; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | # # # Code Set Methods. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | sub lang_set { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lang_set: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my $code_lang = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | $self->{set_sth} = $self->{dbh}->prepare(" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | select code_code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | code_desc, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | code_order, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | code_flag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | from $self->{table} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | where code_set = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | and code_lang = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | order by code_order, code_code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | ") unless $self->{set_sth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $self->{set_sth}->execute($code_set, $code_lang); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | return $self->{set_sth}->fetchall_arrayref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | sub full_set { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
full_set: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | my $code_lang = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my $native = $self->lang_set($code_set, $self->{native}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | return $native if ($code_lang eq $self->{native}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my $other = $self->lang_set($code_set, $code_lang); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | my $lookup = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | for my $row ( @$other ) { $lookup->{$row->[0]} = $row->[1]; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | for ( my $i = 0; $i < @$native; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | my $code_desc = $lookup->{$native->[$i][0]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | $native->[$i][1] = $code_desc if defined $code_desc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | return $native; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | # # # Code Table Updates. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | sub slave { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
slave: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | my $code_code = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | my $code_desc = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | $code_desc = '' unless defined $code_desc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | my @old = $self->get($code_set, $self->{native}, $code_code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | if (@old) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | my ( $old_desc, $old_order, $old_flag ) = @old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | if ($code_desc ne $old_desc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | $self->put($code_set, $self->{native}, $code_code, $code_desc, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | $old_order, $old_flag); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $self->put($code_set, $self->{native}, $code_code, $code_desc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | sub remove { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $code_code = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $code_code .= ''; # DBI needs strings here. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | $self->{remove_sth} = $self->{dbh}->prepare(" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | delete from $self->{table} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | where code_set = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | and code_code = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | ") unless $self->{remove_sth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | $self->{remove_sth}->execute($code_set, $code_code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my $code_lang = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | my $code_code = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | $self->{get_sth} = $self->{dbh}->prepare(" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | select code_desc, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | code_order, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | code_flag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | from $self->{table} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | where code_set = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | and code_lang = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | and code_code = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | ") unless $self->{get_sth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | $self->{get_sth}->execute($code_set, $code_lang, $code_code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | my @info = $self->{get_sth}->fetchrow_array; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | return @info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | sub put { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
put: not called CC=13 SCAR=50.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $code_lang = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | my $code_code = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $code_desc = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | my $code_order = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my $code_flag = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | # Get the existing code info, if any. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | my @old = $self->get($code_set, $code_lang, $code_code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | # Field work. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | $code_code .= ''; # DBI needs strings here. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | $code_desc .= ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | if ($code_lang eq $self->{native}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | if ( !@old and $code_code =~ /^\d+$/ and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
not @old and $code_code =~ /^\d+$/ and !defined($code_order) || $code_order eq ""
not @old and $code_code =~ /^\d+$/
not defined $code_order or $code_order eq ""
MC/DC0%0/4
not @old and $code_code =~ /^\d+$/ and !defined($code_order) || $code_order eq ""
not @old
$code_code =~ /^\d+$/
not defined $code_order
$code_order eq ""
Truth table0%0/5
not(A) and B and not(C) or D
A= not @oldB= $code_code =~ /^\d+$/C= not defined $code_orderD= $code_order eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | ( not defined($code_order) or $code_order eq '' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $code_order = $code_code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | { # Argument "" isn't numeric in int. Isn't that int's job? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | $code_order = int($code_order); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | $code_flag .= ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $code_order = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | $code_flag = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | # Make it so: add, update, or delete. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | if (@old) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my ( $old_desc, $old_order, $old_flag ) = @old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | if ($code_desc ne '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | $code_order ne $old_order || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | $code_flag ne $old_flag) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | $self->_update($code_set, $code_lang, $code_code, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | $code_desc, $code_order, $code_flag); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | if ($code_lang eq $self->{native}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | $self->remove($code_set, $code_code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $self->_delete($code_set, $code_lang, $code_code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | elsif ($code_desc ne '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | $self->_insert($code_set, $code_lang, $code_code, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | $code_desc, $code_order, $code_flag); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | # # # Private methods. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | sub _find_native { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_native: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | my $sth = $self->{dbh}->prepare(" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | select code_lang | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | from $self->{table} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | where code_set = 'code_admin' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | and code_code = 'code_admin' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | "); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | $sth->execute; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | my $native = $sth->fetchrow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | return $native; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | sub _insert { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_insert: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | $self->{insert_sth} = $self->{dbh}->prepare(" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | insert into $self->{table} set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | code_set = ?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | code_lang = ?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | code_code = ?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | code_desc = ?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | code_order = ?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | code_flag = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | ▶ | ") unless $self->{insert_sth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | $self->{insert_sth}->execute(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | sub _update { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_update: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | my $code_set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | my $code_lang = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | my $code_code = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | my $code_desc = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | my $code_order = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | my $code_flag = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | $self->{update_sth} = $self->{dbh}->prepare(" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | update $self->{table} set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | code_desc = ?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | code_order = ?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | code_flag = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | where code_set = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | and code_lang = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | and code_code = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | ") unless $self->{update_sth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | $self->{update_sth}->execute( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | $code_desc, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | $code_order, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | $code_flag, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | $code_set, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | $code_lang, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | $code_code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | ▶ | sub _delete { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_delete: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | $self->{delete_sth} = $self->{dbh}->prepare(" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | delete from $self->{table} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | where code_set = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | and code_lang = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | and code_code = ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | ") unless $self->{delete_sth}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | $self->{delete_sth}->execute(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | sub _getparam { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_getparam: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | my $var_name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | my $default = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | if ( not defined $value ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | if ( $self->{getparam} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | $value = &{$self->{getparam}}($var_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | $value = $default unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | $value = '' unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | ▶ | sub _getparams { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_getparams: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | my $var_name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | my $default = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | if ( not defined $value ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | my $call = $self->{getparams} ? $self->{getparams} : $self->{getparam}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | ▶ | if ( $call ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | $value = [ grep { defined $_ } &$call($var_name) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | $value = $value->[0] if ref $value->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | $value = $default unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | ▶ | $value = '' unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 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)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | ▶ | sub keyme { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
keyme: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | ▶ | return $value if ref($value) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | my $Keyhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | if (ref($value) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | for my $val ( @$value ) { $Keyhash->{$val} = 1; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | ▶ | } 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | $Keyhash->{$value} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | return $Keyhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | sub htmlspecialchars { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
htmlspecialchars: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | $str =~ s/&/\&/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | $str =~ s/"/\"/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | $str =~ s/</\</g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | $str =~ s/>/\>/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||