| 1 | package DBIO::Oracle::Util; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Shared Oracle-specific helper functions for DBIO | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 24 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 24 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 24 | our $VERSION = '0.900007'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 24 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 24 | our @EXPORT_OK = qw(mask_error_details); | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | # What stands in for a value in an error text. | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 24 | my $MASK = '***'; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # The shortest bound value that is looked for verbatim in an error text. A | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # shorter one is a letter or a number, which is part of any text; the server's | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # sentences that quote a value are known below and catch those. | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 24 | my $MIN_BOUND_LENGTH = 4; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | # What may follow the last value of a message: the stack lines of a PL/SQL | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # call (ORA-06512; what stands after the code is the session language's), the | ||||||||||||||||||||||||||||||||||||||||||
| 23 | # line with the link to the error help of 23ai (its label is the language of | ||||||||||||||||||||||||||||||||||||||||||
| 24 | # the client, not of the session -- "Help:", "Hilfe:", "Aide :" with a blank | ||||||||||||||||||||||||||||||||||||||||||
| 25 | # before the colon in French, and a session set to another language does not | ||||||||||||||||||||||||||||||||||||||||||
| 26 | # change it -- the link is what is recognised), the | ||||||||||||||||||||||||||||||||||||||||||
| 27 | # DBD's tag without a statement (also the bare SUCCESS_WITH_INFO of an array | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # execution) and the count of the array execution. A value is masked up to the | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # first place from where the text is nothing but this; a value that holds a | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # line of this kind in its middle is thereby masked as a whole. A text that | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # does not end this way is masked to its end. | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 24 | my $END = qr{ | |||||||||||||||||||||||||||||||||||||||||
| 33 | (?:\nORA-06512:[^\n]*)* | ||||||||||||||||||||||||||||||||||||||||||
| 34 | (?:\n[^\n:]*:\s*https://docs\.oracle\.com/error-help/\S*)? | ||||||||||||||||||||||||||||||||||||||||||
| 35 | (?:[ \t]*\(DBD\ [A-Z_]+(?::\ OCI\w+)?\))? | ||||||||||||||||||||||||||||||||||||||||||
| 36 | (?:\nexecuting\ \d+\ generated\ \d+\ errors)? | ||||||||||||||||||||||||||||||||||||||||||
| 37 | \s*\z | ||||||||||||||||||||||||||||||||||||||||||
| 38 | }x; | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | # A value that runs up to $END (or, if there is none, to the end of the text). | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 24 | my $VALUE = qr/(?:.*?(?=$END)|.*)/s; | |||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | # The statement the DBD appends to a message ("(DBD ERROR: error possibly near | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # <*> indicator at char 39 in 'SELECT ...')") is the caller's own text, with | ||||||||||||||||||||||||||||||||||||||||||
| 46 | # the placeholders written :p1, :p2 and the marker <*> put in. It is split off | ||||||||||||||||||||||||||||||||||||||||||
| 47 | # only when it is that: the statement inside, without the marker and with the | ||||||||||||||||||||||||||||||||||||||||||
| 48 | # placeholders as ?, is $statement the same way, and the marker stands where | ||||||||||||||||||||||||||||||||||||||||||
| 49 | # the char number says. Returns ($message, $appendix); the appendix is empty | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # unless it is the DBD's own. | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 220 | ▶ | sub _split_appendix { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_split_appendix: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 220 | my ($message, $statement) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 220 | ▶ | return ($message, '') unless defined $statement && !ref $statement && length $statement; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
defined $statement and not ref $statement and length $statement
defined $statement and not ref $statement
MC/DC33%1/3
defined $statement and not ref $statement and length $statement
defined $statement
not ref $statement
length $statement
Truth table50%2/4
A and not(B) and C
A= defined $statementB= not ref $statementC= length $statement
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 93 | ▶ | $message =~ /\A(.*)\s*\(DBD\ [A-Z_]+:\ error\ possibly\ near\ <\*>\ indicator\ at\ char\ (\d+)\ in\ '(.*)'\)(?:\nexecuting\ \d+\ generated\ \d+\ errors)?\z/xs | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | or return ($message, ''); | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 14 | my ($head, $at, $inner) = ($1, $2, $3); | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 14 | ▶ | return ($message, '') unless substr($inner, $at, 3) eq '<*>'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 13 | substr($inner, $at, 3, ''); | |||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 13 | my $given = $statement; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 13 | s/:p\d+/?/g for $inner, $given; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 13 | ▶ | return ($message, '') unless $inner eq $given; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 12 | return ($head, substr($message, length $head)); | |||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | # "A:1, B:'x'": the columns and the values of a key (the text between the | ||||||||||||||||||||||||||||||||||||||||||
| 70 | # brackets of ORA-03301). Oracle escapes nothing, so a value may hold ", " or | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # ":" or a quote. The columns are known from the line of ORA-00001 before | ||||||||||||||||||||||||||||||||||||||||||
| 72 | # (@names), and the text is read as a pair list only where that is the one | ||||||||||||||||||||||||||||||||||||||||||
| 73 | # reading: it starts with the first column, and every following ", NAME:" is in | ||||||||||||||||||||||||||||||||||||||||||
| 74 | # it exactly once, in order. Anything else is masked whole. | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 74 | ▶ | sub _mask_key_values { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mask_key_values: called CC=7 SCAR=19.7
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 74 | my ($names, $content) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 74 | ▶ | return $MASK unless @$names && !grep { !length } @$names; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@$names and not grep({not length $_;} @$names)
MC/DC0%0/2
@$names and not grep({not length $_;} @$names)
@$names
not grep({not length $_;} @$names)
Truth table33%1/3
A and not(B)
A= @$namesB= not grep({not length $_;} @$names)
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 74 | ▶ | return $MASK unless index($content, "$names->[0]:") == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 69 | my $pos = length($names->[0]) + 1; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 69 | for my $n (@{$names}[1 .. $#$names]) { | |||||||||||||||||||||||||||||||||||||||||
| 83 | 11 | my $delimiter = ", $n:"; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 11 | my $first = index($content, $delimiter, $pos); | |||||||||||||||||||||||||||||||||||||||||
| 85 | 11 | ▶ | return $MASK if $first < 0 || index($content, $delimiter, $first + 1) >= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$first < 0 or index($content, $delimiter, $first + 1) != -1
MC/DC50%1/2
$first < 0 or index($content, $delimiter, $first + 1) != -1
$first < 0
index($content, $delimiter, $first + 1) != -1
Truth table66%2/3
A or B
A= $first < 0B= index($content, $delimiter, $first + 1) != -1
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 8 | $pos = $first + length $delimiter; | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 66 | return join ', ', map { "$_:$MASK" } @$names; | |||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | # The sentences of the server that hold a value, one rule each. A rule keeps | ||||||||||||||||||||||||||||||||||||||||||
| 93 | # the words around the value -- the type, the column, the constraint -- and | ||||||||||||||||||||||||||||||||||||||||||
| 94 | # replaces the value, wherever the server puts quotes, so a rule never leaves | ||||||||||||||||||||||||||||||||||||||||||
| 95 | # a part of it. Every rule gives the same text again when it is applied to its | ||||||||||||||||||||||||||||||||||||||||||
| 96 | # own result. | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 220 | ▶ | sub _mask_sentences { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mask_sentences: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 220 | my ($text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | # ORA-01722, the first character of the value in quotes, the line before | ||||||||||||||||||||||||||||||||||||||||||
| 101 | # the ORA-03302 line. English: "unable to convert string value containing | ||||||||||||||||||||||||||||||||||||||||||
| 102 | # 'g' to a number: ", German: "Zeichenfolgenwert mit 'g' kann nicht in eine | ||||||||||||||||||||||||||||||||||||||||||
| 103 | # Zahl konvertiert werden: ". The character may be a quote, a blank or a | ||||||||||||||||||||||||||||||||||||||||||
| 104 | # line break, so the text between the first and the last quote of the line | ||||||||||||||||||||||||||||||||||||||||||
| 105 | # goes; a line with no quotes is of a form not known and loses its text. | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 220 | $text =~ s{(\bORA-01722:\ )((?:(?!\nORA-).)*?)(\s*\nORA-03302:\ )} | |||||||||||||||||||||||||||||||||||||||||
| 107 | 51 | {$1 . _mask_quoted($2) . $3}se; | |||||||||||||||||||||||||||||||||||||||||
| 108 | # the same line in English, when no ORA-03302 line follows | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 220 | $text =~ s/(unable to convert string value containing ).*?( to a number: )/$1'$MASK'$2/s; | |||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | # ORA-03302 and ORA-61800: "<label>: <value>". English: "(ORA-01722 | ||||||||||||||||||||||||||||||||||||||||||
| 112 | # details) invalid string value: x", "invalid boolean literal: x"; German: | ||||||||||||||||||||||||||||||||||||||||||
| 113 | # "(ORA-01722-Details) Ungültiger Zeichenfolgenwert: x", "Ungültiges | ||||||||||||||||||||||||||||||||||||||||||
| 114 | # boolesches Literal: x". The label holds no colon; the value is what stands | ||||||||||||||||||||||||||||||||||||||||||
| 115 | # after the first one and may hold anything. A label with no colon in it is | ||||||||||||||||||||||||||||||||||||||||||
| 116 | # of a form not known: the whole text after the code goes. | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 220 | $text =~ s{(\bORA-(?:03302|61800):\ )(?:((?:(?!\(DBD\ )[^:\n])*?:\ )$VALUE|$VALUE)} | |||||||||||||||||||||||||||||||||||||||||
| 118 | 69 | ▶ | {$1 . (defined $2 ? $2 : '') . $MASK}se; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | # ORA-01438, the value in front of the precision. English: "value 99999.9 | ||||||||||||||||||||||||||||||||||||||||||
| 121 | # greater than specified precision (4, 1) for column", German: "Wert 99999,9 | ||||||||||||||||||||||||||||||||||||||||||
| 122 | # ist größer als die angegebene Dezimalstellenanzahl (4, 1) für Spalte". | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 220 | $text =~ s{(\bORA-01438:\ )([^\n]*)}{$1 . _mask_numbers($2, 1)}ge; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | # ORA-01428, the argument. English: "Argument -4 is out of range.", German: | ||||||||||||||||||||||||||||||||||||||||||
| 126 | # "Argument -4 befindet sich außerhalb des zulässigen Wertebereichs." | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 220 | $text =~ s{(\bORA-01428:\ )([^\n]*)}{$1 . _mask_numbers($2)}ge; | |||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | # ORA-00001 with the key of the row, 23ai: | ||||||||||||||||||||||||||||||||||||||||||
| 130 | # ... violated on table APP.USERS columns (A, B) | ||||||||||||||||||||||||||||||||||||||||||
| 131 | # ORA-03301: (ORA-00001 details) row with column values (A:1, B:'x') already exists | ||||||||||||||||||||||||||||||||||||||||||
| 132 | # German: | ||||||||||||||||||||||||||||||||||||||||||
| 133 | # ... für Tabelle APP.USERS mit Spalten (A, B) verletzt | ||||||||||||||||||||||||||||||||||||||||||
| 134 | # ORA-03301: (ORA-00001-Details) Zeile mit Spaltenwerten (A:1, B:'x') ist bereits vorhanden | ||||||||||||||||||||||||||||||||||||||||||
| 135 | # The key is the parenthesis after the label, up to the last bracket that is | ||||||||||||||||||||||||||||||||||||||||||
| 136 | # followed by words (not the one of the DBD's tag) before what Oracle puts | ||||||||||||||||||||||||||||||||||||||||||
| 137 | # after the message; the words before and after it are the session | ||||||||||||||||||||||||||||||||||||||||||
| 138 | # language's. The columns are those in the last parenthesis of the | ||||||||||||||||||||||||||||||||||||||||||
| 139 | # ORA-00001 line before, and the key is only read as a pair list when they | ||||||||||||||||||||||||||||||||||||||||||
| 140 | # fit it (_mask_key_values). A text of another build -- no such label, a | ||||||||||||||||||||||||||||||||||||||||||
| 141 | # tail the end does not follow -- loses all of it after the code. | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 220 | $text =~ s{ | |||||||||||||||||||||||||||||||||||||||||
| 143 | (?<pre>(?:ORA-00001:[^\n]*\((?<names>[^\n]*?)\)[^()\n]*\n)?ORA-03301:\ ) | ||||||||||||||||||||||||||||||||||||||||||
| 144 | (?: | ||||||||||||||||||||||||||||||||||||||||||
| 145 | (?<head>\([^()\n]*\bORA-\d+[^()\n]*\)\ [^()\n]*?\()(?<key>$VALUE)(?<tail>\)\ [^()\n]*[^()\s])(?=$END) | ||||||||||||||||||||||||||||||||||||||||||
| 146 | | $VALUE | ||||||||||||||||||||||||||||||||||||||||||
| 147 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 78 | }{_mask_key_text(\%+)}xse; | |||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 220 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | # ORA-03301 as the match of the rule above gives it: with a label and a key | ||||||||||||||||||||||||||||||||||||||||||
| 154 | # the key is masked, without them the text after the code is. | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 78 | ▶ | sub _mask_key_text { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mask_key_text: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 78 | my ($m) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 157 | 78 | my %m = %$m; | |||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 78 | ▶ | return $m{pre} . $MASK unless defined $m{head}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | return $m{pre} . $m{head} | ||||||||||||||||||||||||||||||||||||||||||
| 161 | . (defined $m{names} ? _mask_key_values([ split /, /, $m{names}, -1 ], $m{key}) : $MASK) | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 76 | ▶ | . $m{tail}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | # "unable to convert string value containing 'g' to a number:" -- what is | ||||||||||||||||||||||||||||||||||||||||||
| 166 | # between the first and the last quote becomes the mask; no quote, no reading. | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 51 | ▶ | sub _mask_quoted { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mask_quoted: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 51 | my ($line) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 51 | ▶ | return "$1$MASK$2" if $line =~ /\A([^'\n]*')(?:.*)('[^'\n]*)\z/s; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 2 | return $MASK; | |||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | # A number as the server prints it in a message -- sign, digits, "." or "," | ||||||||||||||||||||||||||||||||||||||||||
| 175 | # among them, an exponent, all that without a blank -- is taken as the word | ||||||||||||||||||||||||||||||||||||||||||
| 176 | # that holds a digit. | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 24 | my $NUMBER = qr/\S*\d\S*/; | |||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | # The numbers of the line of ORA-01438 and ORA-01428 are the value. With a | ||||||||||||||||||||||||||||||||||||||||||
| 180 | # true $until_precision they are those before the precision "(4, 1)", which | ||||||||||||||||||||||||||||||||||||||||||
| 181 | # the line must have. A line with no number (a value of letters, "Inf"), or | ||||||||||||||||||||||||||||||||||||||||||
| 182 | # with no precision when one is asked for, is not of a form known and loses | ||||||||||||||||||||||||||||||||||||||||||
| 183 | # its text. A line that holds the mask is the line already masked. | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 34 | ▶ | sub _mask_numbers { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mask_numbers: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 34 | my ($line, $until_precision) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 34 | my ($head, $rest) = ($line, ''); | |||||||||||||||||||||||||||||||||||||||||
| 188 | 34 | ▶ | if ($until_precision) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 18 | ▶ | $line =~ /\A(.*?)(\s\(\d+,\s*-?\d+\).*)\z/s or return $MASK; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 16 | ($head, $rest) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 32 | ▶ | return $line if index($head, $MASK) >= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 16 | ▶ | return $MASK unless $head =~ s/$NUMBER/$MASK/g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 15 | return $head . $rest; | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 222 | ▶ | sub mask_error_details { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mask_error_details: called CC=10 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 222 | my ($message, $binds, $statement) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 222 | ▶ | return $message unless defined $message && length $message; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $message and length $message
MC/DC100%2/2
defined $message and length $message
defined $message
length $message
Truth table100%3/3
A and B
A= defined $messageB= length $message
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 220 | my $tail; | |||||||||||||||||||||||||||||||||||||||||
| 204 | 220 | ($message, $tail) = _split_appendix($message, $statement); | |||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 220 | $message = _mask_sentences($message); | |||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 220 | my %seen; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | my @bound = sort { length $b <=> length $a } | |||||||||||||||||||||||||||||||||||||||||
| 210 | 10 | grep { !$seen{$_}++ } | |||||||||||||||||||||||||||||||||||||||||
| 211 | 9 | ▶ | map { my $v = $_; (index($v, "'") >= 0 ? ($v, $v =~ s/'/''/gr) : ($v)) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 14 | ▶ | grep { defined && !ref && length >= $MIN_BOUND_LENGTH } | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
defined $_ && !ref($_) && length $_ >= $MIN_BOUND_LENGTH
defined $_ and not ref $_
MC/DC100%3/3
defined $_ && !ref($_) && length $_ >= $MIN_BOUND_LENGTH
defined $_
not ref $_
length $_ >= $MIN_BOUND_LENGTH
Truth table100%4/4
A and not(B) && C
A= defined $_B= not ref $_C= length $_ >= $MIN_BOUND_LENGTH
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 220 | ▶ | map { ref($_) eq 'ARRAY' && @$_ == 2 ? $_->[1] : $_ } @{ $binds // [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
ref $_ eq "ARRAY" and @$_ == 2
$binds // []
MC/DC100%2/2
ref $_ eq "ARRAY" and @$_ == 2
ref $_ eq "ARRAY"
@$_ == 2
MC/DC100%1/1
$binds // []
$binds
Truth table100%3/3
A and B
A= ref $_ eq "ARRAY"B= @$_ == 2
Truth table100%2/2
A
A= $binds
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 220 | for my $bound (@bound) { | |||||||||||||||||||||||||||||||||||||||||
| 215 | 10 | $message =~ s/\Q$bound\E/$MASK/g; | |||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 220 | return $message . $tail; | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 24 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | __END__ | ||||||||||||||||||||||||||||||||||||||||||