| 1 | 1 | ▶ | use Time::Local; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | sub ABS | ||||||||||||||||||||||||||||
| 4 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ABS: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 5 | 0 | return abs(shift); | |||||||||||||||||||||||||||
| 6 | } | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | sub ADD_MONTHS | ||||||||||||||||||||||||||||
| 9 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ADD_MONTHS: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | 0 | my ($d, $n) = @_; | |||||||||||||||||||||||||||
| 11 | 0 | my @timestuff = localtime($d); | |||||||||||||||||||||||||||
| 12 | 0 | my ($mday) = $timestuff[3]; | |||||||||||||||||||||||||||
| 13 | 0 | $d += (30*86400)*$n; | |||||||||||||||||||||||||||
| 14 | 0 | @timestuff = localtime($d); | |||||||||||||||||||||||||||
| 15 | 0 | my $thisdate = $timestuff[5] + 1900; | |||||||||||||||||||||||||||
| 16 | 0 | ▶ | $thisdate .= '0' if ($timestuff[4] < 9); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | 0 | $thisdate .= $timestuff[4] + 1; | |||||||||||||||||||||||||||
| 18 | 0 | ▶ | $thisdate .= '0' if ($mday < 10); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | 0 | $thisdate .= $mday; | |||||||||||||||||||||||||||
| 20 | 0 | my $xx = timelocal(0,0,0,substr($thisdate,6,2), | |||||||||||||||||||||||||||
| 21 | (substr($thisdate,4,2)-1),substr($thisdate,0,4),0,0,0); | ||||||||||||||||||||||||||||
| 22 | 0 | return $xx; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | sub ASCII | ||||||||||||||||||||||||||||
| 27 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ASCII: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 0 | return ord(shift); | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | sub CEIL | ||||||||||||||||||||||||||||
| 32 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
CEIL: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 33 | 0 | my $n = shift; | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | return int($n) + 1 if ($n > int($n)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | return int($n); | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | sub CHR | ||||||||||||||||||||||||||||
| 39 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
CHR: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 0 | return chr(shift); | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | sub CONCAT | ||||||||||||||||||||||||||||
| 44 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
CONCAT: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | #@_ = &chkcolumnparms(@_); | ||||||||||||||||||||||||||||
| 47 | #return $_[0].$_[1]; | ||||||||||||||||||||||||||||
| 48 | 4 | return join('',@_); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | sub COS | ||||||||||||||||||||||||||||
| 52 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
COS: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | 0 | return cos(shift); | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | sub CURDATE | ||||||||||||||||||||||||||||
| 57 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
CURDATE: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | my $fmt = shift || 'yyyy-mm-dd'; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'yyyy-mm-dd'
MC/DC0%0/1
shift() || 'yyyy-mm-dd'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 59 | 0 | return TO_CHAR(SYSTIME, $fmt) | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | sub DAYS_BETWEEN #SPRITE-ONLY FUNCTION. | ||||||||||||||||||||||||||||
| 63 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
DAYS_BETWEEN: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 64 | 0 | my ($d1, $d2) = @_; | |||||||||||||||||||||||||||
| 65 | 0 | my ($secbtn) = abs($d2 - $d1); | |||||||||||||||||||||||||||
| 66 | 0 | return $secbtn / 86400; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | sub EXP | ||||||||||||||||||||||||||||
| 70 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
EXP: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 71 | 0 | return 2.71828183 ** shift; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | sub FLOOR | ||||||||||||||||||||||||||||
| 75 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
FLOOR: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 76 | 0 | my $n = shift; | |||||||||||||||||||||||||||
| 77 | 0 | ▶ | return int($n) - 1 if ($n < 0 && $n < int($n)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$n < 0 and $n < int $n
MC/DC0%0/2
$n < 0 and $n < int $n
$n < 0
$n < int $n
Truth table0%0/3
A and B
A= $n < 0B= $n < int $n
| |||||||||||||||||||||||||||||
| 78 | 0 | return int($n); | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | sub INITCAP | ||||||||||||||||||||||||||||
| 82 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
INITCAP: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 83 | 0 | my ($s) = shift; | |||||||||||||||||||||||||||
| 84 | 0 | $s =~ s/\b(\w)(\w*)/\U$1\L$2\E/g; | |||||||||||||||||||||||||||
| 85 | 0 | return $s; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | sub INSTR | ||||||||||||||||||||||||||||
| 89 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
INSTR: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 90 | 0 | my ($s, $srch, $n, $m) = @_; | |||||||||||||||||||||||||||
| 91 | 0 | my $t = $n; | |||||||||||||||||||||||||||
| 92 | 0 | ▶ | if ($n < 0) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||
| 94 | 0 | $s = reverse($s); | |||||||||||||||||||||||||||
| 95 | 0 | $srch = reverse($srch); | |||||||||||||||||||||||||||
| 96 | 0 | $t = abs($n); | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | 0 | ▶ | for (my $i=1;$i<=$m;$i++) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | { | ||||||||||||||||||||||||||||
| 100 | 0 | $t = index($s, $srch, $t) + 1; | |||||||||||||||||||||||||||
| 101 | 0 | ▶ | return 0 if ($t < 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | 0 | ▶ | return length($s) - $t if ($n < 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | 0 | return $t; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | sub INSTRB | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
INSTRB: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 109 | 0 | return INSTR(@_); | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | sub LAST_DAY | ||||||||||||||||||||||||||||
| 113 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
LAST_DAY: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 114 | 0 | my ($t) = shift; | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 0 | my @timestuff = localtime($t); | |||||||||||||||||||||||||||
| 117 | 0 | my @lastdate = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); | |||||||||||||||||||||||||||
| 118 | 0 | my $thisdate = $timestuff[5] + 1900; | |||||||||||||||||||||||||||
| 119 | 0 | ▶ | $thisdate .= '0' if ($timestuff[4] < 9); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | 0 | $thisdate .= $timestuff[4] + 1; | |||||||||||||||||||||||||||
| 121 | #$thisdate .= '0' if ($timestuff[3] < 10); | ||||||||||||||||||||||||||||
| 122 | #$thisdate .= $timestuff[3]; | ||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if ($timestuff[4] == 1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | { | ||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if (!(($timestuff[5]+300) % 400)) | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 126 | { | ||||||||||||||||||||||||||||
| 127 | 0 | $thisdate .= '29'; | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | elsif (!($timestuff[5] % 100)) | ||||||||||||||||||||||||||||
| 130 | { | ||||||||||||||||||||||||||||
| 131 | 0 | $thisdate .= '28'; | |||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | elsif (!($timestuff[5] % 4)) | ||||||||||||||||||||||||||||
| 134 | { | ||||||||||||||||||||||||||||
| 135 | 0 | $thisdate .= '29'; | |||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | else | ||||||||||||||||||||||||||||
| 138 | { | ||||||||||||||||||||||||||||
| 139 | 0 | $thisdate .= '28'; | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | else | ||||||||||||||||||||||||||||
| 143 | { | ||||||||||||||||||||||||||||
| 144 | 0 | $thisdate .= $lastdate[$timestuff[4]]; | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | 0 | my $xx = timelocal(0,0,0,substr($thisdate,6,2), | |||||||||||||||||||||||||||
| 147 | (substr($thisdate,4,2)-1),substr($thisdate,0,4),0,0,0); | ||||||||||||||||||||||||||||
| 148 | 0 | return $xx; | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | sub LENGTH | ||||||||||||||||||||||||||||
| 152 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
LENGTH: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 153 | 0 | return length(shift); | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | sub LENGTHB | ||||||||||||||||||||||||||||
| 157 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
LENGTHB: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 158 | 0 | return length(shift); | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | sub LPAD | ||||||||||||||||||||||||||||
| 162 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
LPAD: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 163 | 0 | my ($s, $l, $p) = @_; | |||||||||||||||||||||||||||
| 164 | 0 | my $t = $p x $l; | |||||||||||||||||||||||||||
| 165 | 0 | return substr($t,0,($l-length($s))) . $s; | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | sub LTRIM | ||||||||||||||||||||||||||||
| 169 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
LTRIM: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 170 | 0 | my ($x, $y) = @_; | |||||||||||||||||||||||||||
| 171 | 0 | $x =~ s/^[$y]+//; | |||||||||||||||||||||||||||
| 172 | 0 | return $x; | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | sub LOWER | ||||||||||||||||||||||||||||
| 176 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
LOWER: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 177 | #@_ = &chkcolumnparms(@_); | ||||||||||||||||||||||||||||
| 178 | 0 | my ($s) = shift; | |||||||||||||||||||||||||||
| 179 | 0 | $s =~ tr/A-Z/a-z/; | |||||||||||||||||||||||||||
| 180 | 0 | return $s; | |||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | sub MOD | ||||||||||||||||||||||||||||
| 184 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
MOD: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 185 | 0 | my ($m, $n) = @_; | |||||||||||||||||||||||||||
| 186 | 0 | ▶ | return $m unless ($n); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | 0 | return $m % $n; | |||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | sub MONTHS_BETWEEN #ASSUMES 30-DAY MONTHS - APPROXIMATES THE ORACLE FUNCTION! | ||||||||||||||||||||||||||||
| 191 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
MONTHS_BETWEEN: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 192 | 0 | my ($d1, $d2) = @_; | |||||||||||||||||||||||||||
| 193 | 0 | my ($secbtn) = abs($d2 - $d1); | |||||||||||||||||||||||||||
| 194 | 0 | return $secbtn / (30*86400); | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | sub NOW | ||||||||||||||||||||||||||||
| 198 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
NOW: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | my $fmt = shift || 'yyyy-mm-dd hh:mi:ss'; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'yyyy-mm-dd hh:mi:ss'
MC/DC0%0/1
shift() || 'yyyy-mm-dd hh:mi:ss'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 200 | 0 | return TO_CHAR(SYSTIME, $fmt) | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | sub now | ||||||||||||||||||||||||||||
| 204 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
now: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 205 | 0 | ▶ | my $fmt = shift || 'yyyy-mm-dd hh:mi:ss'; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'yyyy-mm-dd hh:mi:ss'
MC/DC0%0/1
shift() || 'yyyy-mm-dd hh:mi:ss'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 206 | 0 | return TO_CHAR(SYSTIME, $fmt) | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | sub NVL #CHGD. TO LAST LINE 20040325 TO MAKE WORK LIKE ORACLE!? | ||||||||||||||||||||||||||||
| 210 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
NVL: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 211 | # my (@parms) = @_; | ||||||||||||||||||||||||||||
| 212 | # my ($t); | ||||||||||||||||||||||||||||
| 213 | # while ($#parms >= 0) | ||||||||||||||||||||||||||||
| 214 | # { | ||||||||||||||||||||||||||||
| 215 | # $t = shift(@parms); | ||||||||||||||||||||||||||||
| 216 | # return $t if (defined($t) && $t ne ''); | ||||||||||||||||||||||||||||
| 217 | # } | ||||||||||||||||||||||||||||
| 218 | # return defined($t) ? $t : ''; | ||||||||||||||||||||||||||||
| 219 | 0 | ▶ | return (length($_[0]) ? $_[0] : $_[1]); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | sub POWER | ||||||||||||||||||||||||||||
| 223 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
POWER: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 224 | 0 | return $_[0] ** $_[1]; | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | sub REPLACE | ||||||||||||||||||||||||||||
| 228 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
REPLACE: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 229 | 0 | my ($s, $x, $y) = (@_[0..2]); | |||||||||||||||||||||||||||
| 230 | 0 | ▶ | if ($_[3] eq 'i') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 231 | { | ||||||||||||||||||||||||||||
| 232 | 0 | $s =~ s/\Q$x\E/\Q$y\E/ig; #SPRITE EXTENSION, NOT SUPPORTED IN ORACLE! | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | else | ||||||||||||||||||||||||||||
| 235 | { | ||||||||||||||||||||||||||||
| 236 | 0 | $s =~ s/\Q$x\E/\Q$y\E/g; | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | 0 | return $s; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | sub ROUND | ||||||||||||||||||||||||||||
| 242 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ROUND: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 243 | 0 | my ($m, $n) = @_; | |||||||||||||||||||||||||||
| 244 | 0 | ▶ | return sprintf("%.${n}f", $m) if ($n >= 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 245 | 0 | $m *= 10 ** $n; | |||||||||||||||||||||||||||
| 246 | 0 | return (1 * sprintf('%.0f', $m)) / (10 ** $n); | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | sub RPAD | ||||||||||||||||||||||||||||
| 250 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
RPAD: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 251 | 0 | my ($s, $l, $p) = @_; | |||||||||||||||||||||||||||
| 252 | 0 | ▶ | while (length($s) < $l) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 253 | { | ||||||||||||||||||||||||||||
| 254 | 0 | $s .= $p; | |||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | 0 | return substr($s, 0, $l); | |||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | sub RTRIM | ||||||||||||||||||||||||||||
| 260 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
RTRIM: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 261 | 0 | my ($x, $y) = @_; | |||||||||||||||||||||||||||
| 262 | 0 | $x =~ s/[$y]+$//; | |||||||||||||||||||||||||||
| 263 | 0 | return $x; | |||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | sub SIGN | ||||||||||||||||||||||||||||
| 267 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
SIGN: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 268 | 0 | ▶ | return -1 if ($_[0] < 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 269 | 0 | ▶ | return 0 unless ($_[0]); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 270 | 0 | return 1; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | sub SIN | ||||||||||||||||||||||||||||
| 274 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
SIN: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 275 | 0 | return sin(shift); | |||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | sub SQRT | ||||||||||||||||||||||||||||
| 279 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
SQRT: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 280 | 0 | return sqrt(shift); | |||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | sub SUBSTR | ||||||||||||||||||||||||||||
| 284 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
SUBSTR: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 285 | #@_ = &chkcolumnparms(@_); | ||||||||||||||||||||||||||||
| 286 | 0 | my ($s) = shift; | |||||||||||||||||||||||||||
| 287 | 0 | my ($p) = shift; | |||||||||||||||||||||||||||
| 288 | #($s, $p) = &chkcolumnparms(@_); | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 0 | ▶ | return '' unless ($p); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | 0 | ▶ | --$p if ($p > 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | 0 | my ($l) = shift; | |||||||||||||||||||||||||||
| 295 | 0 | ▶ | return (substr($s, $p)) unless ($l); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 296 | 0 | return substr($s, $p, $l); | |||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | sub SUBSTRB | ||||||||||||||||||||||||||||
| 300 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
SUBSTRB: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 301 | 0 | return SUBSTR(@_); | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | sub TO_CHAR | ||||||||||||||||||||||||||||
| 305 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
TO_CHAR: called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 306 | 1 | do 'to_char.pl'; | |||||||||||||||||||||||||||
| 307 | 1 | ▶ | if ($err =~ /^Invalid/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 308 | { | ||||||||||||||||||||||||||||
| 309 | 0 | $errdetails = $err; | |||||||||||||||||||||||||||
| 310 | 0 | $rtnTime = ''; | |||||||||||||||||||||||||||
| 311 | 0 | $self->display_error(-503); | |||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||
| 313 | 1 | return $rtnTime; | |||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | sub TO_DATE | ||||||||||||||||||||||||||||
| 317 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
TO_DATE: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 318 | 0 | do 'to_date.pl'; | |||||||||||||||||||||||||||
| 319 | 0 | ▶ | if ($err =~ /^Invalid/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 320 | { | ||||||||||||||||||||||||||||
| 321 | 0 | $errdetails = $err; | |||||||||||||||||||||||||||
| 322 | 0 | $rtnTime = ''; | |||||||||||||||||||||||||||
| 323 | 0 | $self->display_error(-503); | |||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||
| 325 | 0 | return $rtnTime; | |||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | sub TO_NUMBER | ||||||||||||||||||||||||||||
| 329 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
TO_NUMBER: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 330 | 0 | $rtnTime = shift; | |||||||||||||||||||||||||||
| 331 | 0 | my $fmt = shift; | |||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | 0 | my $fmtstr = 'f'; | |||||||||||||||||||||||||||
| 334 | 0 | ▶ | $fmtstr = $1 if ($rtnTime =~ s/(e)eee//i); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 335 | 0 | $rtnTime =~ s/[^\d\.\+\-Vv]//g; | |||||||||||||||||||||||||||
| 336 | 0 | my $dec = 0; | |||||||||||||||||||||||||||
| 337 | 0 | ▶ | $dec = length($2) if ($fmt =~ /([\d\+\-]*)V(\d*)/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 338 | #my ($dec) = length($2); | ||||||||||||||||||||||||||||
| 339 | 0 | $rtnTime *= (10 ** $dec); | |||||||||||||||||||||||||||
| 340 | 0 | return sprintf('%.0f',$rtnTime); #ROUND IT. | |||||||||||||||||||||||||||
| 341 | 0 | return $rtnTime; | |||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | sub TRANSLATE | ||||||||||||||||||||||||||||
| 345 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
TRANSLATE: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 346 | 0 | my ($s, $a, $b) = @_; | |||||||||||||||||||||||||||
| 347 | 0 | eval "\$s =~ tr/$a/$b/d"; | |||||||||||||||||||||||||||
| 348 | 0 | return $s; | |||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | sub TRUNC | ||||||||||||||||||||||||||||
| 352 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
TRUNC: not called CC=16 SCAR=56.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 353 | 0 | my ($m, $n) = @_; | |||||||||||||||||||||||||||
| 354 | 0 | ▶ | if ($n =~ /D/i) | ||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||
| 355 | { | ||||||||||||||||||||||||||||
| 356 | 0 | my @timestuff = localtime($m); | |||||||||||||||||||||||||||
| 357 | 0 | my $thisdate = $timestuff[5] + 1900; | |||||||||||||||||||||||||||
| 358 | 0 | ▶ | $thisdate .= '0' if ($timestuff[4] < 9); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 359 | 0 | $thisdate .= $timestuff[4] + 1; | |||||||||||||||||||||||||||
| 360 | 0 | ▶ | $thisdate .= '0' if ($timestuff[3] < 10); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 361 | 0 | $thisdate .= $timestuff[3]; | |||||||||||||||||||||||||||
| 362 | 0 | my $xx = timelocal(0,0,0,substr($thisdate,6,2), | |||||||||||||||||||||||||||
| 363 | (substr($thisdate,4,2)-1),substr($thisdate,0,4),0,0,0); | ||||||||||||||||||||||||||||
| 364 | 0 | return $xx; | |||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||
| 366 | elsif ($n =~ /Y/i) | ||||||||||||||||||||||||||||
| 367 | { | ||||||||||||||||||||||||||||
| 368 | 0 | my @timestuff = localtime($m); | |||||||||||||||||||||||||||
| 369 | 0 | my $thisdate = $timestuff[5] + 1900; | |||||||||||||||||||||||||||
| 370 | 0 | my $xx = timelocal(0,0,0,1,0,$thisdate,0,0,0); | |||||||||||||||||||||||||||
| 371 | 0 | return $xx; | |||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||
| 373 | elsif ($n =~ /MI/i) | ||||||||||||||||||||||||||||
| 374 | { | ||||||||||||||||||||||||||||
| 375 | 0 | my @timestuff = localtime($m); | |||||||||||||||||||||||||||
| 376 | 0 | my $thisdate = $timestuff[5] + 1900; | |||||||||||||||||||||||||||
| 377 | 0 | ▶ | $thisdate .= '0' if ($timestuff[4] < 9); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 378 | 0 | $thisdate .= $timestuff[4] + 1; | |||||||||||||||||||||||||||
| 379 | 0 | ▶ | $thisdate .= '0' if ($timestuff[3] < 10); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 380 | 0 | $thisdate .= $timestuff[3]; | |||||||||||||||||||||||||||
| 381 | 0 | ▶ | $thisdate .= '0' if ($timestuff[2] < 10); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 382 | 0 | $thisdate .= $timestuff[2]; | |||||||||||||||||||||||||||
| 383 | 0 | ▶ | $thisdate .= '0' if ($timestuff[1] < 10); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 384 | 0 | $thisdate .= $timestuff[1]; | |||||||||||||||||||||||||||
| 385 | 0 | my $xx = timelocal(0,substr($thisdate,10,2),substr($thisdate,8,2),substr($thisdate,6,2), | |||||||||||||||||||||||||||
| 386 | (substr($thisdate,4,2)-1),substr($thisdate,0,4),0,0,0); | ||||||||||||||||||||||||||||
| 387 | 0 | return $xx; | |||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||
| 389 | elsif ($n =~ /M/i) | ||||||||||||||||||||||||||||
| 390 | { | ||||||||||||||||||||||||||||
| 391 | 0 | my @timestuff = localtime($m); | |||||||||||||||||||||||||||
| 392 | 0 | my $thisdate = $timestuff[5] + 1900; | |||||||||||||||||||||||||||
| 393 | 0 | ▶ | $thisdate .= '0' if ($timestuff[4] < 9); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 394 | 0 | $thisdate .= $timestuff[4] + 1; | |||||||||||||||||||||||||||
| 395 | 0 | my $xx = timelocal(0,0,0,1,(substr($thisdate,4,2)-1),substr($thisdate,0,4),0,0,0); | |||||||||||||||||||||||||||
| 396 | 0 | return $xx; | |||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||
| 398 | elsif ($n =~ /H/i) | ||||||||||||||||||||||||||||
| 399 | { | ||||||||||||||||||||||||||||
| 400 | 0 | my @timestuff = localtime($m); | |||||||||||||||||||||||||||
| 401 | 0 | my $thisdate = $timestuff[5] + 1900; | |||||||||||||||||||||||||||
| 402 | 0 | ▶ | $thisdate .= '0' if ($timestuff[4] < 9); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 403 | 0 | $thisdate .= $timestuff[4] + 1; | |||||||||||||||||||||||||||
| 404 | 0 | ▶ | $thisdate .= '0' if ($timestuff[3] < 10); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 405 | 0 | $thisdate .= $timestuff[3]; | |||||||||||||||||||||||||||
| 406 | 0 | ▶ | $thisdate .= '0' if ($timestuff[2] < 10); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 407 | 0 | $thisdate .= $timestuff[2]; | |||||||||||||||||||||||||||
| 408 | 0 | my $xx = timelocal(0,0,substr($thisdate,8,2),substr($thisdate,6,2), | |||||||||||||||||||||||||||
| 409 | (substr($thisdate,4,2)-1),substr($thisdate,0,4),0,0,0); | ||||||||||||||||||||||||||||
| 410 | 0 | return $xx; | |||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||
| 412 | else | ||||||||||||||||||||||||||||
| 413 | { | ||||||||||||||||||||||||||||
| 414 | 0 | return int($m * (10 ** $n)) / (10 ** $n); | |||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | sub UPPER | ||||||||||||||||||||||||||||
| 419 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
UPPER: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 420 | 0 | my ($s) = shift; | |||||||||||||||||||||||||||
| 421 | 0 | $s =~ tr/a-z/A-Z/; | |||||||||||||||||||||||||||
| 422 | 0 | return $s; | |||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | sub WEEKS_BETWEEN #SPRITE-ONLY FUNCTION. | ||||||||||||||||||||||||||||
| 426 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
WEEKS_BETWEEN: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 427 | 0 | my ($d1, $d2) = @_; | |||||||||||||||||||||||||||
| 428 | 0 | my ($secbtn) = abs($d2 - $d1); | |||||||||||||||||||||||||||
| 429 | 0 | return $secbtn / (7*86400); | |||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | sub YEARS_BETWEEN #SPRITE-ONLY FUNCTION. | ||||||||||||||||||||||||||||
| 433 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
YEARS_BETWEEN: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 434 | 0 | my ($d1, $d2) = @_; | |||||||||||||||||||||||||||
| 435 | 0 | my ($secbtn) = abs($d2 - $d1); | |||||||||||||||||||||||||||
| 436 | 0 | return $secbtn / (365.25*86400); | |||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | 1 | 1 | |||||||||||||||||||||||||||