App/Config.pm

filter: Statementstmt 7.2% 15 / 208 Branchbran 0.0% 0 / 68 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 25.0% 4 / 16 Podpod 0.0% 0 / 12 totaltotal 5.5% 19 / 344 CC 58 SCAR 58.3
CC
58
Cov
5%
parse_file
812.0
screen_from_request
110.0
last_modified_since
56.0
CRAP 341.9
↑ Summary App/Request.pm »
1 package Web::App::Config;
2 # $Id: Config.pm,v 1.31 2009/06/07 20:57:49 apla Exp $
3  
4 1 ▶use Class::Easy;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Storable qw(retrieve nstore);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Web::App::Config::Screen;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
13  
14 =pod
15  
16 =head1 NAME
17  
18 Web::App::Config - parsing Web::App configuration
19  
20 =head1 DESCRIPTION
21  
22 Web::App
23  
24 =cut
25  
26 0 ▶sub path_to_val {
Subroutine path_to_val: not called CC=3 SCAR=24.8
Pod undocumented
27 0 my ($data, $path) = @_;
28
29 0 my @path = split '/', $path;
30 0 foreach (@path) {
31 0 ▶ $data = $data->[$_], next
Branch: 1 branch
BranchTrueFalseTotal
if ref $data eq "ARRAY" 0 0 0
32 if ref $data eq 'ARRAY';
33 0 $data = $data->{$_};
34 }
35 0 return $data;
36 }
37  
38 0 ▶sub assign_path {
Subroutine assign_path: not called CC=3 SCAR=24.8
Pod undocumented
39 0 my ($data, $path, $value) = @_;
40  
41 0 my @path = split '/', $path;
42 0 my $last = pop @path;
43 0 foreach (@path) {
44 0 ▶ unless (exists $data->{$_}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $data->{$_}) 0 0 0
45 # debug "$path => $_";
46 0 $data->{$_} = {};
47 }
48  
49 0 $data = $data->{$_};
50 }
51 0 $data->{$last} = $value;
52 }
53  
54  
55 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
56 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
57 0 ▶sub last_modified_since {
Subroutine last_modified_since: not called CC=7 SCAR=40.3
Pod undocumented
58 0 my $self = shift;
59 0 my $last_modified = shift;
60
61 0 my $config_file = $self->file;
62 0 my $config_dir = ($config_file =~ /^(.*\/)[^\/]+$/)[0];
63
64 0 my $config_files = [$config_file, map {"$config_dir$_"} @{$self->int->{'files'}}];
65
66 0 debug "compare timestamps of the config file '$config_file' and module Web::App::Config";
67  
68 0 my $configuration_package_file = $INC {'Web/App/Config.pm'};
69
70 0 my $package_change = (stat ($configuration_package_file))[9];
71 0 my $config_change = 0;
72  
73 0 foreach $config_file (@$config_files) {
74 0 my $mtime = (stat ($config_file))[9];
75 0 ▶ $config_change = $mtime
Branch: 1 branch
BranchTrueFalseTotal
if $mtime > $config_change 0 0 0
76 if $mtime > $config_change;
77 }
78
79 0 my $outdated = 0;
80  
81 # workaround for configuration init
82 0 ▶ if (not defined $last_modified or $last_modified == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $last_modified or $last_modified == 0) 0 0 0
Condition0%0/3
not defined $last_modified or $last_modified == 0
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $last_modified or $last_modified == 0
not defined $last_modified $last_modified == 0
Truth table0%0/3
not(A) or B
A= not defined $last_modifiedB= $last_modified == 0
ABresult
1X1
011
000
83 0 debug "initial configuration";
84 0 $last_modified = $config_change;
85 }
86
87 0 ▶ if ($config_change > $last_modified) {
Branch: 1 branch
BranchTrueFalseTotal
if ($config_change > $last_modified) 0 0 0
88 0 debug "config changed since last modified";
89 # debug "config (" . scalar localtime ($config_change) . ") changed since last modified (".scalar localtime ($last_modified).")";
90 0 $last_modified = $config_change;
91 0 $outdated = $last_modified;
92 }
93  
94 0 ▶ if ($package_change > $last_modified) {
Branch: 1 branch
BranchTrueFalseTotal
if ($package_change > $last_modified) 0 0 0
95 0 debug "module are newer than configuration";
96 # debug "module (" . scalar localtime ($package_change) . ") are newer than configuration (".scalar localtime ($last_modified).")";
97 0 $last_modified = $package_change;
98 0 $outdated = $last_modified;
99 }
100
101 0 return $outdated;
102
103 }
104 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
105 1 has 'app', is => 'ro';
106 1 has 'file', is => 'ro';
107 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
108 0 ▶sub int {
Subroutine int: not called CC=1 SCAR=6.9
Pod undocumented
109 0 return shift->{'internals'};
110 }
111 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
112 0 ▶sub screens {
Subroutine screens: not called CC=1 SCAR=6.9
Pod undocumented
113 0 return shift->{'internals'}->{'screens'};
114 }
115 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
116 0 ▶sub modules {
Subroutine modules: not called CC=1 SCAR=6.9
Pod undocumented
117 0 return shift->{'internals'}->{'modules'};
118 }
119 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
120 0 ▶sub presenters {
Subroutine presenters: not called CC=1 SCAR=6.9
Pod undocumented
121 0 return shift->{'internals'}->{'presenters'};
122 }
123 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
124 0 ▶sub get {
Subroutine get: not called CC=6 SCAR=37.4
Pod undocumented
125 0 my $class = shift;
126 0 my $app = shift;
127 0 my $config_file = shift;
128
129 # first we need to check existing config in web::app
130 # then we check
131
132 0 my $bin_config_file = $config_file . '.binary';
133  
134 0 my $self = {
135 'file' => $config_file,
136 'app' => $app,
137 'mtime' => 0,
138 'internals' => {
139 'screens' => {},
140 'modules' => {},
141 'presenters' => {},
142 'files' => {},
143 }
144 };
145
146 0 my $mtime_config_binary = 0;
147 0 my $loaded = 0;
148
149 0 ▶ if (-f $bin_config_file) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $bin_config_file) 0 0 0
150 0 $self->{'mtime'} = $mtime_config_binary = (stat ($bin_config_file))[9];
151
152 0 debug "loading configuration binary";
153 0 eval {
154 0 $self->{'internals'} = retrieve ($bin_config_file);
155 0 $loaded = 1;
156 };
157
158 };
159
160 0 ▶ unless (-f $config_file) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f $config_file) 0 0 0
161 0 critical "Can't read config from file $config_file";
162 }
163
164 0 bless $self, $class;
165
166 0 ▶ if (not $loaded or $self->last_modified_since ($mtime_config_binary)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $loaded or $self->last_modified_since($mtime_config_binary)) 0 0 0
Condition0%0/3
not $loaded or $self->last_modified_since($mtime_config_binary)
l!l&&r!l&&!r
000
MC/DC0%0/2
not $loaded or $self->last_modified_since($mtime_config_binary)
not $loaded $self->last_modified_since($mtime_config_binary)
Truth table0%0/3
not(A) or B
A= not $loadedB= $self->last_modified_since($mtime_config_binary)
ABresult
1X1
011
000
167 0 debug 'parsing configuration';
168
169 0 $self->parse_file ($app);
170
171 0 ▶ nstore ($self->{'internals'}, $bin_config_file)
Branch: 1 branch
BranchTrueFalseTotal
nstore($self->{"internals"}, $bin_config_file) or debug("cannot write binary config to '${bin_config_file}'") 0 0 0
172 or debug ("cannot write binary config to '$bin_config_file'");
173
174 }
175
176 # reload mtime after store or retrieve
177 0 $self->{'mtime'} = (stat ($bin_config_file))[9];
178
179 0 return $self;
180 }
181 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
182 0 ▶sub init_modules {
Subroutine init_modules: not called CC=7 SCAR=40.3
Pod undocumented
183 0 my $self = shift;
184
185 0 my $app = $self->app;
186
187 0 my $dump_separators = ',;:\/ ';
188
189 0 foreach my $module (keys %{$self->modules}) {
190 0 ▶ next unless $module;
Branch: 1 branch
BranchTrueFalseTotal
unless $module 0 0 0
191
192 0 my $t = timer ("$module require");
193
194 0 ▶ debug "$@"
Branch: 1 branch
BranchTrueFalseTotal
unless try_to_use($module) 0 0 0
195 unless try_to_use ($module);
196
197 0 my $params = $self->modules->{$module};
198
199 0 my $dump = 'all';
200
201 0 ▶ if (ref $params eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $params eq "HASH") 0 0 0
202
203 0 ▶ if ($module->can ('init') and $params->{type} ne 'use') {
Branch: 1 branch
BranchTrueFalseTotal
if ($module->can('init') and $params->{'type'} ne 'use') { } 0 0 0
Condition0%0/3
$module->can("init") and $params->{"type"} ne "use"
!ll&&!rl&&r
000
MC/DC0%0/2
$module->can("init") and $params->{"type"} ne "use"
$module->can("init") $params->{"type"} ne "use"
Truth table0%0/3
A and B
A= $module->can("init")B= $params->{"type"} ne "use"
ABresult
0X0
100
111
204 0 $t->lap ("$module init");
205 0 $module->init ($params);
206 } else {
207 # debug "module $module doesn't have 'init' method";
208 }
209 }
210
211 0 $t->end;
212 }
213
214 }
215 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
216 0 ▶sub screen {
Subroutine screen: not called CC=1 SCAR=6.9
Pod undocumented
217 0 my $self = shift;
218 0 my $screen_name = shift;
219
220 0 return $self->screens->{$screen_name};
221 }
222 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
223 0 ▶sub parse_file {
Subroutine parse_file: not called CC=28 SCAR=67.0
Pod undocumented
224 0 my $self = shift;
225 0 my $app = shift;
226
227 0 my $screen_config_path = $self->{'file'};
228
229 0 debug 'loading screens configuration';
230
231 0 my $parser = new XML::LibXML;
232 0 my $xp = $parser->parse_file ($screen_config_path);
233
234 0 my @files = $xp->findnodes ('/config/xi:include');
235
236 0 $self->int->{'files'} = [map {$_->getAttribute ('href')} @files];
237 0 $parser->processXIncludes ($xp);
238
239 0 my @plugin_list = $xp->findnodes ('/config/*[local-name() = "extension" or local-name() = "presenter" or local-name() = "use" or local-name() = "request" or local-name() = "session"]');
240
241 0 my $modules = $self->int->{'modules'} = {};
242
243 0 foreach my $plugin (@plugin_list) {
244 0 my @arguments = $plugin->findnodes ('@*');
245
246 0 my $module_params = {'type' => ''};
247
248 0 foreach (@arguments) {
249 #$module = $module->string_value;
250 #debug "found '" . $plugin->nodeName . "'in module: '$module'";
251
252 0 $module_params->{$_->localname} = $_->nodeValue;
253 }
254
255 0 my $defined_type = $module_params->{'type'};
256 0 my $computed_type = $plugin->nodeName;
257 0 ▶ $computed_type .= ':' . $defined_type
Branch: 1 branch
BranchTrueFalseTotal
if defined $defined_type and $defined_type ne "" 0 0 0
Condition0%0/3
defined $defined_type and $defined_type ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $defined_type and $defined_type ne ""
defined $defined_type $defined_type ne ""
Truth table0%0/3
A and B
A= defined $defined_typeB= $defined_type ne ""
ABresult
0X0
100
111
258 if defined $defined_type and $defined_type ne '';
259
260 0 $module_params->{'type'} = $computed_type;
261
262 0 my $module_name = delete $module_params->{'pack'};
263
264 # after parsing, store module config
265 0 $modules->{$module_name} = $module_params;
266
267 0 debug "found $module_name in ", $plugin->localname;
268 }
269
270 0 my $screens_node = $xp->findnodes ('/config/screens')->get_node(1);
271
272 0 my $screens = $self->int->{'screens'} = {};
273
274 0 $screens->{'#base-uri'} = $screens_node->findvalue ('base-url/text()');
275 0 $screens->{'#separators'} = $screens_node->findvalue ('request-queue/@separators');
276
277 0 $screens->{'#user-name-separator'} =
278 $screens_node->findvalue ('request-queue/user-name/@separator-symbol');
279
280 0 $screens->{'#user-name-position'} =
281 $screens_node->findvalue ('request-queue/user-name/@name-position');
282
283 0 my @screen_nodes_list = $screens_node->findnodes ('screen');
284 # find all paragraphs
285
286 #my $presenters_dir = $self->{'home'} . '/share/presentation/' .
287 # $self->{'template-set'} . '/';
288
289 #debug 'presenters in \'' . $presenters_dir . '\'';
290
291 0 foreach my $screen (@screen_nodes_list) {
292  
293 0 my $id = $screen->getAttribute ('id');
294 next
295 0 ▶ unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 0 0
296
297 0 my $screen_object = Web::App::Config::Screen->create ($id);
298
299 0 $screen_object->{auth} = $screen->getAttribute ('auth');
300
301 0 ▶ if ($id ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($id ne '') { } 0 0 0
302 0 assign_path ($screens, "$id/?", $screen_object);
303 $screens->{$id}->{'?'} = $screen_object
304 0 ▶ unless defined $screens->{$id};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $screens->{$id} 0 0 0
305 } else {
306 0 assign_path ($screens, "?", $screen_object);
307 }
308
309 0 my $presenter_attrs = ();
310 0 foreach my $presenter_attr (($screen->findnodes ('presentation'))[0]->attributes) {
311 0 $presenter_attrs->{$presenter_attr->localName} =
312 $presenter_attr->value;
313 }
314
315 die "Can't locate presenter type in screen '$id', ", $screen->toString (1)
316 0 ▶ unless $presenter_attrs->{type};
Branch: 1 branch
BranchTrueFalseTotal
unless $presenter_attrs->{"type"} 0 0 0
317
318 0 my $regexp = $screen->findvalue ('@regexp');
319 0 ▶ $screen_object->{regexp} = $regexp
Branch: 1 branch
BranchTrueFalseTotal
if $regexp 0 0 0
320 if $regexp;
321
322 0 $screen_object->presentation ($presenter_attrs);
323
324 0 my $req_max_size = $screen->findvalue ('@request-max-size');
325 0 ▶ $screen_object->request->{'max-size'} = $req_max_size
Branch: 1 branch
BranchTrueFalseTotal
if defined $req_max_size and $req_max_size =~ /\d+/ 0 0 0
Condition0%0/3
defined $req_max_size and $req_max_size =~ /\d+/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $req_max_size and $req_max_size =~ /\d+/
defined $req_max_size $req_max_size =~ /\d+/
Truth table0%0/3
A and B
A= defined $req_max_sizeB= $req_max_size =~ /\d+/
ABresult
0X0
100
111
326 if defined $req_max_size and $req_max_size =~ /\d+/;
327
328 0 foreach my $context ('call', 'init/call', 'process/call') {
329 0 my @call_nodes = $screen->findnodes ($context);
330
331 0 my $type = ($context =~ /^(?:(init|process)\/)?call$/)[0];
332 0 my $call = 'add_call';
333 0 ▶ $call = "add_${type}_call"
Branch: 1 branch
BranchTrueFalseTotal
if defined $type 0 0 0
334 if defined $type;
335
336 0 foreach my $call_node (@call_nodes) {
337 0 my @param_attrs = $call_node->findnodes ('@*');
338
339 0 my $params = {};
340
341 0 foreach (@param_attrs) {
342
343 0 my $param_name = $_->localname;
344 0 my $param_value = $_->nodeValue;
345
346 0 $params->{$param_name} = $param_value;
347 }
348
349 0 ▶ if (exists $params->{'sub'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params->{"sub"}) 0 0 0
350
351 0 my $sub = $params->{'sub'};
352 0 $screen_object->$call ($params);
353 # debug "added $call to $sub";
354 0 my $module = ($sub =~ /(.*)(?:->|::)/)[0];
355
356 0 ▶ if ($module =~ /^\$([^:]+)/ and $app->can ($1)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($module =~ /^\$([^:]+)/ and $app->can($1)) { } 0 0 0
Condition0%0/3
$module =~ /^\$([^:]+)/ and $app->can($1)
!ll&&!rl&&r
000
MC/DC0%0/2
$module =~ /^\$([^:]+)/ and $app->can($1)
$module =~ /^\$([^:]+)/ $app->can($1)
Truth table0%0/3
A and B
A= $module =~ /^\$([^:]+)/B= $app->can($1)
ABresult
0X0
100
111
357 # debug 'this is a call for web app internals';
358 } else {
359 0 $modules->{$module} = {type => 'use'};
360 }
361
362 # try_to_use ($module);
363 }
364 }
365 }
366
367 0 $screen_object->{'params'} = [];
368
369 0 my @param_nodes = $screen->findnodes ('param');
370
371 0 foreach my $param (@param_nodes) {
372 0 my $field_params = {
373 'name' => undef,
374 'required' => undef,
375 'type' => undef, # regexp:... or email, as example. available types in request.pm
376 'multi' => undef, # multivalued parameter
377 'filter' => undef, # trim-space, as example. available types in request.pm
378 'default' => undef, # default values for this object
379 };
380 0 push @{$screen_object->{'params'}}, $field_params;
381
382 0 foreach my $var (keys %$field_params) {
383 0 ▶ $field_params->{$var} = $param->getAttribute ($var)
Branch: 1 branch
BranchTrueFalseTotal
if $param->hasAttribute($var) 0 0 0
384 if $param->hasAttribute ($var);
385 }
386
387 0 ▶ if ($field_params->{name}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($field_params->{"name"}) 0 0 0
388 0 $screen_object->{'params_hash'}->{$field_params->{name}} = $field_params;
389 }
390
391 $field_params->{'default'} = [$field_params->{'default'}]
392 0 ▶ if defined $field_params->{'default'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $field_params->{"default"} 0 0 0
393 0 ▶ $field_params->{'default'} = []
Branch: 1 branch
BranchTrueFalseTotal
if $param->findvalue("count(default)") > 0 0 0 0
394 if $param->findvalue ('count(default)') > 0;
395
396 0 foreach my $defaults ($param->findnodes ('default')) {
397 0 push @{$field_params->{'default'}}, $defaults->textContent;
398 }
399 }
400 }
401
402 # use Data::Dumper;
403 # debug Dumper $self;
404
405 0 return;
406 }
407 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
408  
409 =pod
410  
411 sub path_from_request
412  
413 this procedure return screen object and path info.
414  
415 example:
416  
417 request is: http://some.com/web-app/admin/article/12345
418  
419 configuration is:
420  
421 <config>
422 ...
423 <screens>
424 ...
425 <base-url>/web-app</base-url>
426 ...
427 <screen id='admin'>
428 <presentation type='xslt' filename='not-found.xsl'/>
429 </screen>
430  
431 <screen id='admin/article'>
432 <presentation type='xslt' filename='not-found.xsl'/>
433 </screen>
434 ...
435  
436 </screens>
437 </config>
438  
439 sub return screen object for screen with
440 id = 'admin/article' and path info = '12345'
441  
442 =cut
443
444 0 ▶sub screen_from_request {
Subroutine screen_from_request: not called CC=10 SCAR=47.0
Pod undocumented
445 0 my $self = shift;
446 0 my $path = shift;
447
448 0 my $screens = $self->screens;
449
450 0 my $separators = $screens->{'#separators'};
451
452 0 $separators =~ s/([\/\[\]\(\)])/\\$1/g;
453
454 0 my $screen = $screens;
455
456 0 my $matches = [];
457
458 0 while (1) {
459 0 my ($path_element, $tail) = split /[$separators]/, $path, 2;
460
461 #debug "path element: $path_element, tail: $tail";
462
463 0 ▶ return ($screen->{'?'}, $path, $matches)
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path_element 0 0 0
464 unless defined $path_element;
465
466 0 ▶ if (defined $screen->{$path_element} and $screen->{$path_element}->{'?'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $screen->{$path_element} and $screen->{$path_element}{'?'}) { } 0 0 0
Condition0%0/3
defined $screen->{$path_element} and $screen->{$path_element}{"?"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $screen->{$path_element} and $screen->{$path_element}{"?"}
defined $screen->{$path_element} $screen->{$path_element}{"?"}
Truth table0%0/3
A and B
A= defined $screen->{$path_element}B= $screen->{$path_element}{"?"}
ABresult
0X0
100
111
467 0 $screen = $screen->{$path_element};
468 0 $path = $tail;
469 } else {
470 # try to find screen by regexp
471
472 0 my $matched = 0;
473
474 0 my @children_screen = grep {!/[\/\#\?]/} keys %$screen;
475  
476 # use Data::Dumper;
477 # debug Dumper \@children_screen;
478
479 0 foreach my $match (@children_screen) {
480 0 my $is_regexp = $screen->{$match}->{'?'}->{regexp};
481
482 0 ▶ next unless $is_regexp;
Branch: 1 branch
BranchTrueFalseTotal
unless $is_regexp 0 0 0
483
484 0 ▶ if ($path_element =~ /$match/i and $screen->{$match}->{'?'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($path_element =~ /$match/i and $screen->{$match}{"?"}) 0 0 0
Condition0%0/3
$path_element =~ /$match/i and $screen->{$match}{"?"}
!ll&&!rl&&r
000
MC/DC0%0/2
$path_element =~ /$match/i and $screen->{$match}{"?"}
$path_element =~ /$match/i $screen->{$match}{"?"}
Truth table0%0/3
A and B
A= $path_element =~ /$match/iB= $screen->{$match}{"?"}
ABresult
0X0
100
111
485 0 $screen = $screen->{$match};
486 0 $path = $tail;
487 0 ▶ push @$matches, $1
Branch: 1 branch
BranchTrueFalseTotal
if defined $1 0 0 0
488 if defined $1;
489 0 $matched = 1;
490 }
491 }
492
493 0 ▶ return ($screen->{'?'}, $path, $matches)
Branch: 1 branch
BranchTrueFalseTotal
unless $matched 0 0 0
494 unless $matched;
495 }
496 }
497 }
498  
499 1 1;
↑ Summary App/Request.pm »