blib/lib/Langertha/Holmgang/Sim/Schichtfehler.pm

filter: Statementstmt 100% 152 / 152 Branchbran 78.9% 60 / 76 Conditioncond 59.3% 51 / 86 MC/DCmcdc 26.6% 12 / 45 Subroutinesub 100% 21 / 21 Podpod 100% 5 / 5 totaltotal 78.1% 301 / 385 CC 77 SCAR 23.7
CC
77
Cov
84%
_t_befund_melden
20.7
_t_seite_abrufen
15.7
_t_datei_lesen
13.5
CRAP 10.6
« blib/lib/Langertha/Holmgang/Sim/IOS.pm ↑ Summary blib/lib/Langertha/Holmgang/Evaluation.pm »
1 package Langertha::Holmgang::Sim::Schichtfehler;
2 # ABSTRACT: The answer world schichtfehler — a web application from recorded pages: sources, fetches, console, reported findings
3  
4 38 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 38 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 38 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 38 with 'Langertha::Holmgang::Role::AnswerWorld';
9  
10 38 our $VERSION = '0.001';
11  
12  
13 38 our $MAX_SPAN = 30;
14  
15 38 our @SCHICHTEN = qw( php html js json sql http );
16  
17 38 our @KATEGORIEN = qw(
18 quoting script_ende interpolation ausgabe_vor_json ausgabe_vor_header zahlformat
19 doppelt_maskiert doppelte_id ladereihenfolge sql_bindung sql_platzhalter url_kodierung sonstiges
20 );
21  
22 # Die Werkzeuge dieser Welt mit ihren Pflichtparametern (fuer den Lader).
23 38 our %TOOLS = (
24 dateien_auflisten => [],
25 datei_lesen => ['pfad'],
26 seite_abrufen => ['pfad'],
27 browser_konsole => ['pfad'],
28 befund_melden => [qw( datei zeile_von zeile_bis ursache_schicht symptom_schicht kategorie )],
29 kein_fehler_melden => [],
30 );
31  
32 #### Plugin contract
33  
34 78 ▶sub device_type { 'schichtfehler' }
Subroutine device_type: called CC=1 SCAR=0.0
Pod documented
35  
36  
37 3 ▶sub tools { return \%TOOLS }
Subroutine tools: called CC=1 SCAR=0.0
Pod documented
38  
39  
40 29 ▶sub tool {
Subroutine tool: called CC=5 SCAR=16.7
Pod documented
41 29 my ( $self, $dev, $name, $args, $ctx ) = @_;
42 29 ▶ $name //= '';
Condition50%1/2
$name //= ""
l!l
290
MC/DC0%0/1
$name //= ""
$name
Truth table50%1/2
A
A= $name
Aresult
11
00
43 29 ▶ my $code = $TOOLS{$name} && $self->can( '_t_'.$name )
Branch: 1 branch
BranchTrueFalseTotal
my $code = $Langertha::Holmgang::Sim::Schichtfehler::TOOLS{$name} && $self->can('_t_' . $name) or return q[Fehler: unbekanntes Werkzeug '] . $name . q['], 0 28 1 29
Condition66%2/3
$Langertha::Holmgang::Sim::Schichtfehler::TOOLS{$name} && $self->can('_t_' . $name)
!ll&&!rl&&r
1028
MC/DC50%1/2
$Langertha::Holmgang::Sim::Schichtfehler::TOOLS{$name} && $self->can('_t_' . $name)
$Langertha::Holmgang::Sim::Schichtfehler::TOOLS{$name} $self->can('_t_' . $name)
Truth table66%2/3
A && B
A= $Langertha::Holmgang::Sim::Schichtfehler::TOOLS{$name}B= $self->can('_t_' . $name)
ABresult
0X0
100
111
44 or return ( "Fehler: unbekanntes Werkzeug '".$name."'", 0 );
45 28 ▶ return $self->$code( $dev, $args || {} );
Condition50%1/2
$args || {}
l!l
280
MC/DC0%0/1
$args || {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
46 }
47  
48  
49 #### Pfade und Queries (reine Funktionen)
50  
51 54 ▶sub norm_path {
Subroutine norm_path: called CC=5 SCAR=16.4
Pod documented
52 54 my ( $p ) = @_;
53 54 ▶ $p = '' unless defined $p && !ref $p;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $p and not ref $p 0 54 54
Condition33%1/3
defined $p and not ref $p
!ll&&!rl&&r
0054
MC/DC0%0/2
defined $p and not ref $p
defined $p not ref $p
Truth table33%1/3
A and not(B)
A= defined $pB= not ref $p
ABresult
0X0
100
111
54 54 $p =~ s/\A\s+|\s+\z//g;
55 54 my $q = '';
56 54 ▶ $q = $1 if $p =~ s/\?(.*)\z//s;
Branch: 1 branch
BranchTrueFalseTotal
if $p =~ s/\?(.*)\z//s 2 52 54
57 54 $p =~ s{\A(?:\./|/)+}{};
58 54 $p =~ s{/\./}{/}g;
59 54 ▶ return wantarray ? ( $p, $q ) : $p;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 10 44 54
60 }
61  
62  
63 17 ▶sub norm_query {
Subroutine norm_query: called CC=7 SCAR=20.2
Pod documented
64 17 my ( $q ) = @_;
65 17 ▶ $q = '' unless defined $q && !ref $q;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $q and not ref $q 0 17 17
Condition33%1/3
defined $q and not ref $q
!ll&&!rl&&r
0017
MC/DC0%0/2
defined $q and not ref $q
defined $q not ref $q
Truth table33%1/3
A and not(B)
A= defined $qB= not ref $q
ABresult
0X0
100
111
66 17 $q =~ s/\A\s*\??//;
67 17 $q =~ s/\s+\z//;
68 17 my @pairs;
69 17 for my $part ( split /&/, $q ) {
70 13 ▶ next unless length $part;
Branch: 1 branch
BranchTrueFalseTotal
unless length $part 0 13 13
71 13 my ( $k, $v ) = split /=/, $part, 2;
72 13 ▶ $v //= '';
Condition50%1/2
$v //= ""
l!l
130
MC/DC0%0/1
$v //= ""
$v
Truth table50%1/2
A
A= $v
Aresult
11
00
73 13 ( $k, $v ) = map { _unescape($_) } $k, $v;
74 13 push @pairs, [ $k, $v ];
75 }
76 13 return join '&', map { _escape( $_->[0] ).'='._escape( $_->[1] ) }
77 17 ▶ sort { $a->[0] cmp $b->[0] || $a->[1] cmp $b->[1] } @pairs;
Condition66%2/3
$$a[0] cmp $$b[0] || $$a[1] cmp $$b[1]
l!l&&r!l&&!r
510
MC/DC0%0/2
$$a[0] cmp $$b[0] || $$a[1] cmp $$b[1]
$$a[0] cmp $$b[0] $$a[1] cmp $$b[1]
Truth table66%2/3
A || B
A= $$a[0] cmp $$b[0]B= $$a[1] cmp $$b[1]
ABresult
1X1
011
000
78 }
79  
80  
81 26 ▶sub _unescape {
Subroutine _unescape: called CC=1 SCAR=0.0
82 26 my ( $s ) = @_;
83 26 $s =~ tr/+/ /;
84 26 $s =~ s/%([0-9A-Fa-f]{2})/chr hex $1/ge;
85 26 utf8::decode($s);
86 26 return $s;
87 }
88  
89 26 ▶sub _escape {
Subroutine _escape: called CC=1 SCAR=0.0
90 26 my ( $s ) = @_;
91 26 my $b = $s;
92 26 utf8::encode($b);
93 26 $b =~ s/([^A-Za-z0-9\-._~])/sprintf '%%%02X', ord $1/ge;
94 26 return $b;
95 }
96  
97 21 ▶sub _lines {
Subroutine _lines: called CC=3 SCAR=11.0
98 21 my ( $text ) = @_;
99 21 my @l = split /\n/, $text, -1;
100 21 ▶ pop @l if @l && $l[-1] eq ''; # Zeilenende am Schluss ist keine eigene Zeile
Branch: 1 branch
BranchTrueFalseTotal
if @l and $l[-1] eq "" 18 3 21
Condition100%3/3
@l and $l[-1] eq ""
!ll&&!rl&&r
1218
MC/DC100%2/2
@l and $l[-1] eq ""
@l $l[-1] eq ""
Truth table100%3/3
A and B
A= @lB= $l[-1] eq ""
ABresult
0X0
100
111
101 21 return @l;
102 }
103  
104 8 ▶sub _numbered {
Subroutine _numbered: called CC=3 SCAR=11.0
105 8 my ( $lines, $from ) = @_;
106 8 ▶ $from //= 1;
Condition100%2/2
$from //= 1
l!l
35
MC/DC100%1/1
$from //= 1
$from
Truth table100%2/2
A
A= $from
Aresult
11
00
107 8 my $w = length( $from + $#$lines );
108 8 ▶ $w = 3 if $w < 3;
Branch: 1 branch
BranchTrueFalseTotal
if $w < 3 8 0 8
109 8 return join "\n", map { sprintf( "%*d| %s", $w, $from + $_, $lines->[$_] ) } 0 .. $#$lines;
110 }
111  
112 27 ▶sub _int {
Subroutine _int: called CC=4 SCAR=17.1
113 27 my ( $v ) = @_;
114 27 ▶ return undef unless defined $v && !ref $v && $v =~ /\A\s*(\d+)\s*\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v and not ref $v and $v =~ /\A\s*(\d+)\s*\z/ 0 27 27
Condition33%2/6
defined $v and not ref $v and $v =~ /\A\s*(\d+)\s*\z/
!ll&&!rl&&r
0027
defined $v and not ref $v
!ll&&!rl&&r
0027
MC/DC0%0/3
defined $v and not ref $v and $v =~ /\A\s*(\d+)\s*\z/
defined $v not ref $v $v =~ /\A\s*(\d+)\s*\z/
Truth table25%1/4
A and not(B) and C
A= defined $vB= not ref $vC= $v =~ /\A\s*(\d+)\s*\z/
ABCresult
0XX0
10X0
1100
1111
115 27 return 0 + $1;
116 }
117  
118 #### Werkzeuge
119  
120 1 ▶sub _t_dateien_auflisten {
Subroutine _t_dateien_auflisten: called CC=3 SCAR=11.2
121 1 my ( $self, $dev ) = @_;
122 1 ▶ my $d = $dev->{dateien} || {};
Condition50%1/2
$$dev{'dateien'} || {}
l!l
10
MC/DC0%0/1
$$dev{'dateien'} || {}
$$dev{'dateien'}
Truth table50%1/2
A
A= $$dev{'dateien'}
Aresult
11
00
123 1 ▶ return ( 'Keine Dateien.', 1 ) unless %$d;
Branch: 1 branch
BranchTrueFalseTotal
unless %$d 0 1 1
124 1 return ( join( "\n", map { my $n = () = _lines( $d->{$_} ); sprintf '%s (%d Zeilen)', $_, $n } sort keys %$d ), 1 );
125 }
126  
127 5 ▶sub _t_datei_lesen {
Subroutine _t_datei_lesen: called CC=12 SCAR=26.0
128 5 my ( $self, $dev, $p ) = @_;
129 5 my $path = norm_path( $p->{pfad} );
130 5 ▶ my $text = ( $dev->{dateien} || {} )->{$path};
Condition50%1/2
$$dev{'dateien'} || {}
l!l
50
MC/DC0%0/1
$$dev{'dateien'} || {}
$$dev{'dateien'}
Truth table50%1/2
A
A= $$dev{'dateien'}
Aresult
11
00
131 5 ▶ return ( "Fehler: Datei '".$path."' nicht vorhanden.", 0 ) unless defined $text;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $text 1 4 5
132 4 my @l = _lines($text);
133 4 ▶ my $von = exists $p->{von} ? _int( $p->{von} ) : 1;
Branch: 1 branch
BranchTrueFalseTotal
exists $$p{'von'} ? : 3 1 4
134 4 ▶ my $bis = exists $p->{bis} ? _int( $p->{bis} ) : scalar @l;
Branch: 1 branch
BranchTrueFalseTotal
exists $$p{'bis'} ? : 2 2 4
135 4 ▶ return ( 'Fehler: von und bis sind Zeilennummern ab 1.', 0 ) unless defined $von && defined $bis && $von >= 1;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $von and defined $bis and $von >= 1 0 4 4
Condition33%2/6
defined $von and defined $bis and $von >= 1
!ll&&!rl&&r
004
defined $von and defined $bis
!ll&&!rl&&r
004
MC/DC0%0/3
defined $von and defined $bis and $von >= 1
defined $von defined $bis $von >= 1
Truth table25%1/4
A and B and C
A= defined $vonB= defined $bisC= $von >= 1
ABCresult
0XX0
10X0
1100
1111
136 4 ▶ return ( '(leere Datei)', 1 ) unless @l;
Branch: 1 branch
BranchTrueFalseTotal
unless @l 0 4 4
137 4 ▶ return ( 'Fehler: die Datei hat '.scalar(@l).' Zeilen.', 0 ) if $von > @l;
Branch: 1 branch
BranchTrueFalseTotal
if $von > @l 1 3 4
138 3 ▶ $bis = @l if $bis > @l;
Branch: 1 branch
BranchTrueFalseTotal
if $bis > @l 1 2 3
139 3 ▶ return ( 'Fehler: bis liegt vor von.', 0 ) if $bis < $von;
Branch: 1 branch
BranchTrueFalseTotal
if $bis < $von 0 3 3
140 3 return ( _numbered( [ @l[ $von - 1 .. $bis - 1 ] ], $von ), 1 );
141 }
142  
143 # Aufgezeichneter Abruf/Konsole zu Pfad + Parameter; sonst Text fuer Fehler bzw. Luecke.
144 9 ▶sub _recorded {
Subroutine _recorded: called CC=4 SCAR=13.9
145 9 my ( $self, $dev, $list, $p ) = @_;
146 9 my ( $path, $inline ) = norm_path( $p->{pfad} );
147 18 ▶ my $query = norm_query( join '&', grep { length } $inline,
Branch: 1 branch
BranchTrueFalseTotal
defined $$p{'parameter'} && !ref($$p{'parameter'}) ? : 4 5 9
Condition66%2/3
defined $$p{"parameter"} and not ref $$p{"parameter"}
!ll&&!rl&&r
504
MC/DC50%1/2
defined $$p{"parameter"} and not ref $$p{"parameter"}
defined $$p{"parameter"} not ref $$p{"parameter"}
Truth table66%2/3
A and not(B)
A= defined $$p{"parameter"}B= not ref $$p{"parameter"}
ABresult
0X0
100
111
148 9 ( defined $p->{parameter} && !ref $p->{parameter} ? $p->{parameter} : '' ) );
149 9 ▶ my @same = grep { norm_path( $_->{pfad} ) eq $path } @{ $dev->{$list} || [] };
Condition50%1/2
$$dev{$list} || []
l!l
90
MC/DC0%0/1
$$dev{$list} || []
$$dev{$list}
Truth table50%1/2
A
A= $$dev{$list}
Aresult
11
00
150 9 my ( $hit ) = grep { norm_query( $_->{parameter} ) eq $query } @same;
151 9 return ( $hit, $path, $query, \@same );
152 }
153  
154 3 ▶sub _no_record {
Subroutine _no_record: called CC=7 SCAR=20.7
155 3 my ( $self, $dev, $path, $query, $same ) = @_;
156 3 ▶ my $exists = exists( ( $dev->{dateien} || {} )->{$path} );
Condition50%1/2
$$dev{'dateien'} || {}
l!l
30
MC/DC0%0/1
$$dev{'dateien'} || {}
$$dev{'dateien'}
Truth table50%1/2
A
A= $$dev{'dateien'}
Aresult
11
00
157 3 ▶ return ( "HTTP/1.1 404 Not Found\nContent-Type: text/html; charset=UTF-8\n\n"
Branch: 1 branch
BranchTrueFalseTotal
unless $exists 1 2 3
158 ._numbered( [ '<!doctype html><html><head><title>404 Not Found</title></head><body>',
159 '<h1>Not Found</h1><p>The requested resource <code>/'.$path.'</code> was not found on this server.</p></body></html>' ] ), 1 )
160 unless $exists;
161 2 ▶ my @known = map { length( $_->{parameter} // '' ) ? norm_query( $_->{parameter} ) : '(ohne Parameter)' } @$same;
Branch: 1 branch
BranchTrueFalseTotal
length($$_{'parameter'} // '') ? : 0 2 2
Condition50%1/2
$$_{"parameter"} // ""
l!l
20
MC/DC0%0/1
$$_{"parameter"} // ""
$$_{"parameter"}
Truth table50%1/2
A
A= $$_{"parameter"}
Aresult
11
00
162 2 ▶ my $show = $query eq '' ? '(ohne Parameter)' : $query;
Branch: 1 branch
BranchTrueFalseTotal
$query eq '' ? : 0 2 2
163 2 ▶ return ( 'Für '.$path.' mit '.$show.' liegt keine Aufzeichnung vor. Aufgezeichnet: '.( @known ? join( ', ', @known ) : 'nichts' ).'.',
Branch: 1 branch
BranchTrueFalseTotal
@known ? : 2 0 2
164 0, 'seite_abrufen/browser_konsole: '.$path.'?'.$query.' nicht aufgezeichnet' );
165 }
166  
167 7 ▶sub _t_seite_abrufen {
Subroutine _t_seite_abrufen: called CC=14 SCAR=27.5
168 7 my ( $self, $dev, $p ) = @_;
169 7 my ( $hit, $path, $query, $same ) = $self->_recorded( $dev, abrufe => $p );
170 7 ▶ if ( !$hit && $path !~ /\.php\z/ && defined( my $text = ( $dev->{dateien} || {} )->{$path} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $hit || $path =~ /\.php\z/ and defined(my $text = ($$dev{"dateien"} || {})->{$path})) 1 6 7
Condition87%7/8
not $hit || $path =~ /\.php\z/ and defined(my $text = ($$dev{"dateien"} || {})->{$path})
!ll&&!rl&&r
511
$hit || $path =~ /\.php\z/
l!l&&r!l&&!r
412
$$dev{'dateien'} || {}
l!l
20
MC/DC66%2/3
not $hit || $path =~ /\.php\z/ and defined(my $text = ($$dev{"dateien"} || {})->{$path})
$hit $path =~ /\.php\z/ $$dev{'dateien'}
Truth table75%3/4
not(A || B) and C
A= $hitB= $path =~ /\.php\z/C= $$dev{'dateien'}
ABCresult
1XX0
01X0
0000
0011
171 # statische Datei: der Server liefert sie, wie sie ist
172 1 ▶ my $type = $path =~ /\.css\z/ ? 'text/css' : $path =~ /\.js\z/ ? 'text/javascript' : 'text/plain';
Branch: 2 branches
BranchTrueFalseTotal
$path =~ /\.css\z/ ? : 1 0 1
$path =~ /\.js\z/ ? : 0 0 0
173 1 my @body = _lines($text);
174 1 ▶ return ( "HTTP/1.1 200 OK\nContent-Type: ".$type."; charset=UTF-8\n\n".( @body ? _numbered( \@body ) : '(leerer Rumpf)' ), 1 );
Branch: 1 branch
BranchTrueFalseTotal
@body ? : 1 0 1
175 }
176 6 ▶ return $self->_no_record( $dev, $path, $query, $same ) unless $hit;
Branch: 1 branch
BranchTrueFalseTotal
unless $hit 2 4 6
177 4 ▶ my @head = ( $hit->{status_zeile} // 'HTTP/1.1 '.( $hit->{status} // '' ), @{ $hit->{kopf} || [] } );
Condition66%4/6
$$hit{"status_zeile"} // 'HTTP/1.1 ' . ($$hit{"status"} // "")
l!l
13
$$hit{"status"} // ""
l!l
30
$$hit{'kopf'} || []
l!l
40
MC/DC100%1/1
$$hit{"status_zeile"} // 'HTTP/1.1 ' . ($$hit{"status"} // "")
$$hit{"status_zeile"}
MC/DC0%0/1
$$hit{"status"} // ""
$$hit{"status"}
MC/DC0%0/1
$$hit{'kopf'} || []
$$hit{'kopf'}
Truth table100%2/2
A
A= $$hit{"status_zeile"}
Aresult
11
00
Truth table50%1/2
A
A= $$hit{"status"}
Aresult
11
00
Truth table50%1/2
A
A= $$hit{'kopf'}
Aresult
11
00
178 4 ▶ my @body = _lines( $hit->{rumpf} // '' );
Condition50%1/2
$$hit{"rumpf"} // ""
l!l
40
MC/DC0%0/1
$$hit{"rumpf"} // ""
$$hit{"rumpf"}
Truth table50%1/2
A
A= $$hit{"rumpf"}
Aresult
11
00
179 4 ▶ return ( join( "\n", @head )."\n\n".( @body ? _numbered( \@body ) : '(leerer Rumpf)' ), 1 );
Branch: 1 branch
BranchTrueFalseTotal
@body ? : 3 1 4
180 }
181  
182 2 ▶sub _t_browser_konsole {
Subroutine _t_browser_konsole: called CC=2 SCAR=6.9
183 2 my ( $self, $dev, $p ) = @_;
184 2 my ( $hit, $path, $query, $same ) = $self->_recorded( $dev, konsole => $p );
185 2 ▶ return $self->_no_record( $dev, $path, $query, $same ) unless $hit;
Branch: 1 branch
BranchTrueFalseTotal
unless $hit 1 1 2
186 1 return ( $hit->{ausgabe}, 1 );
187 }
188  
189 12 ▶sub _t_befund_melden {
Subroutine _t_befund_melden: called CC=20 SCAR=30.3
190 12 my ( $self, $dev, $p ) = @_;
191 12 my $path = norm_path( $p->{datei} );
192 12 ▶ my $text = ( $dev->{dateien} || {} )->{$path};
Condition50%1/2
$$dev{'dateien'} || {}
l!l
120
MC/DC0%0/1
$$dev{'dateien'} || {}
$$dev{'dateien'}
Truth table50%1/2
A
A= $$dev{'dateien'}
Aresult
11
00
193 12 ▶ return ( "Fehler: Datei '".$path."' nicht vorhanden.", 0 ) unless defined $text;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $text 1 11 12
194 11 my ( $von, $bis ) = map { _int( $p->{$_} ) } qw( zeile_von zeile_bis );
195 11 ▶ return ( 'Fehler: zeile_von und zeile_bis sind Zeilennummern ab 1.', 0 ) unless defined $von && defined $bis && $von >= 1;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $von and defined $bis and $von >= 1 1 10 11
Condition50%3/6
defined $von and defined $bis and $von >= 1
!ll&&!rl&&r
0110
defined $von and defined $bis
!ll&&!rl&&r
0011
MC/DC33%1/3
defined $von and defined $bis and $von >= 1
defined $von defined $bis $von >= 1
Truth table50%2/4
A and B and C
A= defined $vonB= defined $bisC= $von >= 1
ABCresult
0XX0
10X0
1100
1111
196 10 ▶ return ( 'Fehler: zeile_bis liegt vor zeile_von.', 0 ) if $bis < $von;
Branch: 1 branch
BranchTrueFalseTotal
if $bis < $von 1 9 10
197 9 my $n = () = _lines($text);
198 9 ▶ return ( 'Fehler: '.$path.' hat '.$n.' Zeilen.', 0 ) if $bis > $n;
Branch: 1 branch
BranchTrueFalseTotal
if $bis > $n 1 8 9
199 8 ▶ return ( 'Fehler: Bereich zu groß (höchstens '.$MAX_SPAN.' Zeilen) — bitte die Stelle der Ursache eingrenzen.', 0 )
Branch: 1 branch
BranchTrueFalseTotal
if $bis - $von + 1 > $Langertha::Holmgang::Sim::Schichtfehler::MAX_SPAN 1 7 8
200 if $bis - $von + 1 > $MAX_SPAN;
201 7 for my $k (qw( ursache_schicht symptom_schicht )) {
202 13 ▶ my $v = $p->{$k} // '';
Condition50%1/2
$$p{$k} // ""
l!l
130
MC/DC0%0/1
$$p{$k} // ""
$$p{$k}
Truth table50%1/2
A
A= $$p{$k}
Aresult
11
00
203 13 ▶ return ( 'Fehler: '.$k.' ist eine von '.join( ', ', @SCHICHTEN ).'.', 0 ) unless grep { $_ eq $v } @SCHICHTEN;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_ eq $v;} @Langertha::Holmgang::Sim::Schichtfehler::SCHICHTEN 1 12 13
204 }
205 6 ▶ my $kat = $p->{kategorie} // '';
Condition50%1/2
$$p{"kategorie"} // ""
l!l
60
MC/DC0%0/1
$$p{"kategorie"} // ""
$$p{"kategorie"}
Truth table50%1/2
A
A= $$p{"kategorie"}
Aresult
11
00
206 6 ▶ return ( 'Fehler: kategorie ist eine von '.join( ', ', @KATEGORIEN ).'.', 0 ) unless grep { $_ eq $kat } @KATEGORIEN;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_ eq $kat;} @Langertha::Holmgang::Sim::Schichtfehler::KATEGORIEN 1 5 6
207 5 my @trifft;
208 5 ▶ for my $u ( @{ $dev->{ursachen} || [] } ) {
Condition50%1/2
$$dev{'ursachen'} || []
l!l
50
MC/DC0%0/1
$$dev{'ursachen'} || []
$$dev{'ursachen'}
Truth table50%1/2
A
A= $$dev{'ursachen'}
Aresult
11
00
209 push @trifft, $u->{id}
210 10 ▶ if grep { norm_path( $_->{datei} ) eq $path && $_->{von} <= $bis && $_->{bis} >= $von } @{ $u->{orte} || [] };
Branch: 1 branch
BranchTrueFalseTotal
if grep {norm_path($$_{"datei"}) eq $path and $$_{"von"} <= $bis and $$_{"bis"} >= $von;} @{$$u{"orte"} or [];} 2 8 10
Condition87%7/8
norm_path($$_{'datei'}) eq $path && $$_{'von'} <= $bis && $$_{'bis'} >= $von
!ll&&!rl&&r
712
norm_path($$_{"datei"}) eq $path and $$_{"von"} <= $bis
!ll&&!rl&&r
523
$$u{'orte'} || []
l!l
100
MC/DC100%3/3
norm_path($$_{'datei'}) eq $path && $$_{'von'} <= $bis && $$_{'bis'} >= $von
norm_path($$_{"datei"}) eq $path $$_{"von"} <= $bis $$_{'bis'} >= $von
MC/DC0%0/1
$$u{'orte'} || []
$$u{'orte'}
Truth table100%4/4
A and B && C
A= norm_path($$_{"datei"}) eq $pathB= $$_{"von"} <= $bisC= $$_{'bis'} >= $von
ABCresult
0XX0
10X0
1100
1111
Truth table50%1/2
A
A= $$u{'orte'}
Aresult
11
00
211 }
212 5 push @{ $dev->{befunde} }, {
213 datei => $path, zeile_von => $von, zeile_bis => $bis, ursache_schicht => $p->{ursache_schicht},
214 5 symptom_schicht => $p->{symptom_schicht}, kategorie => $kat, trifft => \@trifft,
215 };
216 5 return ( 'Befund '.scalar( @{ $dev->{befunde} } ).' aufgenommen ('.$path.', Zeilen '.$von.'–'.$bis.').', 1 );
217 }
218  
219 1 ▶sub _t_kein_fehler_melden {
Subroutine _t_kein_fehler_melden: called CC=1 SCAR=0.0
220 1 my ( $self, $dev ) = @_;
221 1 $dev->{kein_fehler} = 1;
222 1 return ( 'Aufgenommen: kein Fehler.', 1 );
223 }
224  
225 38 __PACKAGE__->meta->make_immutable;
226  
227 __END__
« blib/lib/Langertha/Holmgang/Sim/IOS.pm ↑ Summary blib/lib/Langertha/Holmgang/Evaluation.pm »