Ex/App.pm

filter: Statementstmt 97.8% 590 / 603 Branchbran 84.6% 298 / 352 Conditioncond 74.2% 257 / 346 MC/DCmcdc 48.2% 95 / 197 Subroutinesub 98.1% 162 / 165 Podpod 76.3% 103 / 135 totaltotal 83.7% 1505 / 1798 CC 318 SCAR 20.6
CC
318
Cov
88%
generate_form
42.0
_do_auth
24.2
morph
20.4
CRAP 7.8
« Ex/JSONDump.pm ↑ Summary Ex/App/Constants.pm »
1 package CGI::Ex::App;
2  
3 ###---------------------###
4 # Copyright - Paul Seamons
5 # Distributed under the Perl Artistic License without warranty
6  
7 2 ▶use 5.006; #our
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 BEGIN {
10 2 ▶ eval { use Time::HiRes qw(time) };
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶ eval { use Scalar::Util };
Subroutine BEGIN: called CC=1 SCAR=0.0
12 }
13 2 our $VERSION = '2.54'; # VERSION
14  
15 21 ▶sub croak { die sprintf "%s at %3\$s line %4\$s\n", $_[0], caller 1 }
Subroutine croak: called CC=1 SCAR=0.0
Pod undocumented
16  
17 sub new {
18 196 ▶ my $class = shift || croak "Missing class name";
Subroutine new: called CC=4 SCAR=13.9
Pod documented
Condition66%2/3
shift() || croak('Missing class name')
l!l&&r!l&&!r
19420
MC/DC0%0/2
shift() || croak('Missing class name')
shift() croak('Missing class name')
Truth table33%1/3
A || B
A= shift()B= croak('Missing class name')
ABresult
1X1
011
000
19 194 ▶ my $self = bless ref($_[0]) ? shift() : (@_ % 2) ? {} : {@_}, $class;
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] ? : 76 118 194
@_ % 2 ? : 11 107 118
20 194 $self->init;
21 194 $self->init_from_conf;
22 192 return $self;
23 }
24  
25 ▶sub init {}
Subroutine init: called CC=1 SCAR=0.0
Pod documented
26 sub init_from_conf {
27 194 ▶ my $self = shift;
Subroutine init_from_conf: called CC=3 SCAR=11.0
Pod documented
28 194 ▶ @$self{keys %$_} = values %$_ if $self->load_conf and $_ = $self->conf;
Branch: 1 branch
BranchTrueFalseTotal
if $self->load_conf and $_ = $self->conf 3 189 192
Condition100%3/3
$self->load_conf and $_ = $self->conf
!ll&&!rl&&r
18914
MC/DC50%1/2
$self->load_conf and $_ = $self->conf
$self->load_conf $_ = $self->conf
Truth table66%2/3
A and B
A= $self->load_confB= $_ = $self->conf
ABresult
0X0
100
111
29 }
30  
31 sub import { # only ever called with explicit use CGI::Ex::App qw() - not with use base
32 3 ▶ my $class = shift;
Subroutine import: called CC=2 SCAR=7.0
33 3 ▶ return if not @_ = grep { /^:?App($|__)/ } @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ = grep({/^:?App($|__)/;} @_) 0 3 3
34 3 require CGI::Ex::App::Constants;
35 3 unshift @_, 'CGI::Ex::App::Constants';
36 3 goto &CGI::Ex::App::Constants::import;
37 }
38  
39 ###---------------------###
40  
41 sub navigate {
42 78 ▶ my ($self, $args) = @_;
Subroutine navigate: called CC=14 SCAR=26.9
Pod documented
43 78 ▶ $self = $self->new($args) if ! ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 12 66 78
44  
45 78 $self->{'_time'} = time;
46 78 eval {
47 78 ▶ return $self if ! $self->{'_no_pre_navigate'} && $self->pre_navigate;
Branch: 1 branch
BranchTrueFalseTotal
if not $self->{"_no_pre_navigate"} and $self->pre_navigate 1 77 78
Condition100%3/3
not $self->{"_no_pre_navigate"} and $self->pre_navigate
!ll&&!rl&&r
1761
MC/DC100%2/2
not $self->{"_no_pre_navigate"} and $self->pre_navigate
not $self->{"_no_pre_navigate"} $self->pre_navigate
Truth table100%3/3
not(A) and B
A= not $self->{"_no_pre_navigate"}B= $self->pre_navigate
ABresult
0X0
100
111
48 77 ▶ local $self->{'_morph_lineage_start_index'} = $#{$self->{'_morph_lineage'} || []};
Branch: 1 branch
BranchTrueFalseTotal
$self->{"_morph_lineage"} or [] 75 2 77
49 77 $self->nav_loop;
50 };
51 78 my $err = $@;
52 78 ▶ if ($err && (ref($err) || $err ne "Long Jump\n")) { # catch any errors
Branch: 1 branch
BranchTrueFalseTotal
if ($err and ref $err || $err ne "Long Jump\n") 8 70 78
Condition83%5/6
$err and ref $err || $err ne "Long Jump\n"
!ll&&!rl&&r
59118
ref $err or $err ne "Long Jump\n"
l!l&&r!l&&!r
0811
MC/DC66%2/3
$err and ref $err || $err ne "Long Jump\n"
$err ref $err $err ne "Long Jump\n"
Truth table75%3/4
A and B or C
A= $errB= ref $errC= $err ne "Long Jump\n"
ABCresult
0XX0
1000
11X1
1011
53 8 ▶ die $err if ! $self->can('handle_error');
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can("handle_error") 0 8 8
54 8 ▶ if (! eval { $self->handle_error($err); 1 }) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { $self->handle_error($err); 1 } }) 2 6 8
55 2 die "$err\nAdditionally, the following happened while calling handle_error: $@";
56 }
57 }
58 76 ▶ $self->handle_error($@) if ! $self->{'_no_post_navigate'} && ! eval { $self->post_navigate; 1 } && $@ && $@ ne "Long Jump\n";
Branch: 1 branch
BranchTrueFalseTotal
if not $self->{"_no_post_navigate"} || eval { do { $self->post_navigate; 1 } } and $@ and $@ ne "Long Jump\n" 0 76 76
Condition44%4/9
not $self->{"_no_post_navigate"} || eval { do { $self->post_navigate; 1 } } and $@ and $@ ne "Long Jump\n"
!ll&&!rl&&r
7600
not $self->{"_no_post_navigate"} || eval { do { $self->post_navigate; 1 } } and $@
!ll&&!rl&&r
7600
$self->{'_no_post_navigate'} || eval { do { $self->post_navigate; 1 } }
l!l&&r!l&&!r
1750
MC/DC0%0/4
not $self->{"_no_post_navigate"} || eval { do { $self->post_navigate; 1 } } and $@ and $@ ne "Long Jump\n"
$self->{'_no_post_navigate'} eval { do { $self->post_navigate; 1 } } $@ $@ ne "Long Jump\n"
Truth table40%2/5
not(A || B) and C and D
A= $self->{'_no_post_navigate'}B= eval { do { $self->post_navigate; 1 } }C= $@D= $@ ne "Long Jump\n"
ABCDresult
1XXX0
01XX0
000X0
00100
00111
59 76 $self->destroy;
60 76 return $self;
61 }
62  
63 sub nav_loop {
64 153 ▶ my $self = shift;
Subroutine nav_loop: called CC=15 SCAR=27.1
Pod documented
65 153 ▶ local $self->{'_recurse'} = $self->{'_recurse'} || 0;
Condition100%2/2
$self->{'_recurse'} || 0
l!l
7479
MC/DC100%1/1
$self->{'_recurse'} || 0
$self->{'_recurse'}
Truth table100%2/2
A
A= $self->{'_recurse'}
Aresult
11
00
66 153 ▶ if ($self->{'_recurse'}++ >= $self->recurse_limit) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_recurse"}++ >= $self->recurse_limit) 2 151 153
67 2 my $err = "recurse_limit (".$self->recurse_limit.") reached";
68 2 ▶ croak(($self->{'jumps'} || 0) <= 1 ? $err : "$err number of jumps (".$self->{'jumps'}.")");
Branch: 1 branch
BranchTrueFalseTotal
($self->{'jumps'} || 0) <= 1 ? : 2 0 2
Condition50%1/2
$self->{'jumps'} || 0
l!l
02
MC/DC0%0/1
$self->{'jumps'} || 0
$self->{'jumps'}
Truth table50%1/2
A
A= $self->{'jumps'}
Aresult
11
00
69 }
70  
71 151 my $path = $self->path;
72 149 ▶ return if $self->pre_loop($path);
Branch: 1 branch
BranchTrueFalseTotal
if $self->pre_loop($path) 1 148 149
73  
74 148 ▶ foreach ($self->{'path_i'} ||= 0; $self->{'path_i'} <= $#$path; $self->{'path_i'}++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"path_i"} <= $path->$#*) 127 57 184
Condition100%2/2
$self->{"path_i"} ||= 0
l!l
44104
MC/DC100%1/1
$self->{"path_i"} ||= 0
$self->{"path_i"}
Truth table100%2/2
A
A= $self->{"path_i"}
Aresult
11
00
75 127 my $step = $path->[$self->{'path_i'}];
76 127 ▶ if ($step !~ /^([^\W0-9]\w*)$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($step =~ /^([^\W0-9]\w*)$/) 1 126 127
77 1 $self->stash->{'forbidden_step'} = $step;
78 1 $self->goto_step($self->forbidden_step);
79 }
80 126 $step = $1; # untaint
81  
82 126 ▶ if (! $self->is_authed) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->is_authed) 125 1 126
83 125 my $req = $self->run_hook('require_auth', $step, 1);
84 125 ▶ return if (ref($req) ? $req->{$step} : $req) && ! $self->run_hook('get_valid_auth', $step);
Branch: 2 branches
BranchTrueFalseTotal
if ref $req ? $req->{$step} : $req and not $self->run_hook("get_valid_auth", $step) 0 118 118
ref $req ? : 3 122 125
Condition66%2/3
ref $req ? $req->{$step} : $req and not $self->run_hook("get_valid_auth", $step)
!ll&&!rl&&r
11780
MC/DC0%0/2
ref $req ? $req->{$step} : $req and not $self->run_hook("get_valid_auth", $step)
ref $req ? $req->{$step} : $req not $self->run_hook("get_valid_auth", $step)
Truth table66%2/3
A and not(B)
A= ref $req ? $req->{$step} : $reqB= not $self->run_hook("get_valid_auth", $step)
ABresult
0X0
100
111
85 }
86  
87 119 $self->run_hook('morph', $step); # let steps be in external modules
88 117 $self->parse_path_info('path_info_map', $self->run_hook('path_info_map', $step));
89 115 ▶ if ($self->run_hook('run_step', $step)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->run_hook("run_step", $step)) 68 36 104
90 68 $self->run_hook('unmorph', $step);
91 68 return;
92 }
93  
94 36 $self->run_hook('refine_path', $step, $self->{'path_i'} >= $#$path);
95 36 $self->run_hook('unmorph', $step);
96 }
97  
98 57 ▶ return if $self->post_loop($path);
Branch: 1 branch
BranchTrueFalseTotal
if $self->post_loop($path) 1 56 57
99 56 $self->insert_path($self->default_step); # run the default step as a last resort
100 56 $self->nav_loop; # go recursive
101 22 return;
102 }
103  
104 sub path {
105 329 ▶ my $self = shift;
Subroutine path: called CC=8 SCAR=20.8
Pod documented
106 329 ▶ return $self->{'path'} ||= do {
Condition66%2/3
$self->{"path"} ||= do { my @path; $self->parse_path_info("path_info_map_base", $self->path_info_map_base); my $step = $self->form->{$self->step_key}; if (defined $step) { $step =~ s[^/+][]; $step =~ s[/][__]g; if ($step =~ /^_/) { $self->stash->{"forbidden_step"} = $step; push @path, $self->forbidden_step; } elsif ($self->valid_steps and not $self->valid_steps->{$step} and $step ne $self->default_step and $step ne $self->js_step) { $self->stash->{"forbidden_step"} = $step; push @path, $self->forbidden_step; } else { push @path, $step; } ; } ; \@path }
l!l&&r!l&&!r
249800
MC/DC0%0/2
$self->{"path"} ||= do { my @path; $self->parse_path_info("path_info_map_base", $self->path_info_map_base); my $step = $self->form->{$self->step_key}; if (defined $step) { $step =~ s[^/+][]; $step =~ s[/][__]g; if ($step =~ /^_/) { $self->stash->{"forbidden_step"} = $step; push @path, $self->forbidden_step; } elsif ($self->valid_steps and not $self->valid_steps->{$step} and $step ne $self->default_step and $step ne $self->js_step) { $self->stash->{"forbidden_step"} = $step; push @path, $self->forbidden_step; } else { push @path, $step; } ; } ; \@path }
$self->{"path"} do { my @path; $self->parse_path_info("path_info_map_base", $self->path_info_map_base); my $step = $self->form->{$self->step_key}; if (defined $step) { $step =~ s[^/+][]; $step =~ s[/][__]g; if ($step =~ /^_/) { $self->stash->{"forbidden_step"} = $step; push @path, $self->forbidden_step; } elsif ($self->valid_steps and not $self->valid_steps->{$step} and $step ne $self->default_step and $step ne $self->js_step) { $self->stash->{"forbidden_step"} = $step; push @path, $self->forbidden_step; } else { push @path, $step; } ; } ; \@path }
Truth table66%2/3
A ||= B
A= $self->{"path"}B= do { my @path; $self->parse_path_info("path_info_map_base", $self->path_info_map_base); my $step = $self->form->{$self->step_key}; if (defined $step) { $step =~ s[^/+][]; $step =~ s[/][__]g; if ($step =~ /^_/) { $self->stash->{"forbidden_step"} = $step; push @path, $self->forbidden_step; } elsif ($self->valid_steps and not $self->valid_steps->{$step} and $step ne $self->default_step and $step ne $self->js_step) { $self->stash->{"forbidden_step"} = $step; push @path, $self->forbidden_step; } else { push @path, $step; } ; } ; \@path }
ABresult
1X1
011
000
107 80 my @path;
108 80 $self->parse_path_info('path_info_map_base', $self->path_info_map_base); # add initial items to the form hash from path_info
109 76 my $step = $self->form->{$self->step_key}; # make sure the step is valid
110 76 ▶ if (defined $step) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $step) 41 35 76
111 41 $step =~ s|^/+||; $step =~ s|/|__|g;
112 41 ▶ if ($step =~ /^_/) { # can't begin with _
Branch: 2 branches
BranchTrueFalseTotal
if ($step =~ /^_/) { } 1 40 41
elsif ($self->valid_steps and not $self->valid_steps->{$step} and $step ne $self->default_step and $step ne $self->js_step) { } 1 39 40
113 1 $self->stash->{'forbidden_step'} = $step;
114 1 push @path, $self->forbidden_step;
115 ▶ } elsif ($self->valid_steps # must be in valid_steps if defined
Condition100%9/9
$self->valid_steps and not $self->valid_steps->{$step} and $step ne $self->default_step and $step ne $self->js_step
!ll&&!rl&&r
3811
$self->valid_steps and not $self->valid_steps->{$step} and $step ne $self->default_step
!ll&&!rl&&r
3712
$self->valid_steps and not $self->valid_steps->{$step}
!ll&&!rl&&r
3613
MC/DC100%4/4
$self->valid_steps and not $self->valid_steps->{$step} and $step ne $self->default_step and $step ne $self->js_step
$self->valid_steps not $self->valid_steps->{$step} $step ne $self->default_step $step ne $self->js_step
Truth table100%5/5
A and not(B) and C and D
A= $self->valid_stepsB= not $self->valid_steps->{$step}C= $step ne $self->default_stepD= $step ne $self->js_step
ABCDresult
0XXX0
10XX0
110X0
11100
11111
116 && ! $self->valid_steps->{$step}
117 && $step ne $self->default_step
118 && $step ne $self->js_step) {
119 1 $self->stash->{'forbidden_step'} = $step;
120 1 push @path, $self->forbidden_step;
121 } else {
122 39 push @path, $step;
123 }
124 }
125 76 \@path;
126 };
127 }
128  
129 sub parse_path_info {
130 197 ▶ my ($self, $type, $maps, $info, $form) = @_;
Subroutine parse_path_info: called CC=11 SCAR=24.1
Pod undocumented
131 197 ▶ return if !$maps;
Branch: 1 branch
BranchTrueFalseTotal
unless $maps 109 88 197
132 88 ▶ $info ||= $self->path_info || return;
Condition80%4/5
$info ||= $self->path_info || (return)
l!l&&r!l&&!r
03751
$self->path_info || (return)
l!l
1870
MC/DC50%1/2
$info ||= $self->path_info || (return)
$info $self->path_info
Truth table66%2/3
A ||= B
A= $infoB= $self->path_info
ABresult
1X1
011
000
133 18 ▶ croak "Usage: sub $type { [] }" if ! UNIVERSAL::isa($maps, 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::isa($maps, "ARRAY") 3 15 18
134 15 foreach my $map (@$maps) {
135 12 ▶ croak "Usage: sub $type { [[qr{/path_info/(\\w+)}, 'keyname']] }" if ! UNIVERSAL::isa($map, 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::isa($map, "ARRAY") 3 9 12
136 9 ▶ my @match = $info =~ $map->[0] or next;
Branch: 1 branch
BranchTrueFalseTotal
my(@match) = $info =~ /$map->[0]/ or next 3 6 9
137 6 ▶ $form ||= $self->form;
Condition33%1/3
$form ||= $self->form
l!l&&r!l&&!r
060
MC/DC0%0/2
$form ||= $self->form
$form $self->form
Truth table33%1/3
A ||= B
A= $formB= $self->form
ABresult
1X1
011
000
138 6 ▶ if (UNIVERSAL::isa($map->[1], 'CODE')) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($map->[1], 'CODE')) { } 1 5 6
139 1 $map->[1]->($form, @match);
140 } else {
141 5 $form->{$map->[$_]} = $match[$_ - 1] foreach grep {! defined $form->{$map->[$_]}} 1 .. $#$map;
142 }
143 6 last;
144 }
145 }
146  
147 sub run_hook {
148 2545 ▶ my ($self, $hook, $step, @args) = @_;
Subroutine run_hook: called CC=5 SCAR=16.1
Pod documented
149 2545 ▶ my ($code, $found) = (ref $hook eq 'CODE') ? ($_[1], $hook = 'coderef') : ($self->find_hook($hook, $step));
Branch: 1 branch
BranchTrueFalseTotal
ref $hook eq 'CODE' ? : 0 2545 2545
150 2545 ▶ croak "Could not find a method named ${step}_${hook} or ${hook}" if ! $code;
Branch: 1 branch
BranchTrueFalseTotal
unless $code 1 2544 2545
151  
152 2544 ▶ return scalar $self->$code($step, @args) if !$self->{'no_history'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"no_history"} 2513 31 2544
153  
154 31 push @{ $self->history }, my $hist = {step => $step, meth => $hook, found => $found, time => time, level => $self->{'_level'}, elapsed => 0};
155 31 ▶ local $self->{'_level'} = 1 + ($self->{'_level'} || 0);
Condition100%2/2
$self->{'_level'} || 0
l!l
2011
MC/DC100%1/1
$self->{'_level'} || 0
$self->{'_level'}
Truth table100%2/2
A
A= $self->{'_level'}
Aresult
11
00
156 31 $hist->{'elapsed'} = time - $hist->{'time'};
157 31 return $hist->{'response'} = $self->$code($step, @args);
158 }
159  
160 sub find_hook {
161 2545 ▶ my ($self, $hook, $step) = @_;
Subroutine find_hook: called CC=5 SCAR=16.1
Pod documented
162 2545 ▶ croak "Missing hook name" if ! $hook;
Branch: 1 branch
BranchTrueFalseTotal
unless $hook 1 2544 2545
163 2544 ▶ if ($step and my $code = $self->can("${step}_${hook}")) {
Branch: 2 branches
BranchTrueFalseTotal
if ($step and my $code = $self->can("${step}_$hook")) { } 311 2233 2544
elsif ($code = $self->can($hook)) { } 2232 1 2233
Condition100%3/3
$step and my $code = $self->can("${step}_$hook")
!ll&&!rl&&r
92224311
MC/DC100%2/2
$step and my $code = $self->can("${step}_$hook")
$step my $code = $self->can("${step}_$hook")
Truth table100%3/3
A and B
A= $stepB= my $code = $self->can("${step}_$hook")
ABresult
0X0
100
111
164 311 return ($code, "${step}_${hook}");
165 } elsif ($code = $self->can($hook)) {
166 2232 return ($code, $hook);
167 }
168 1 return;
169 }
170  
171 sub run_hook_as {
172 3 ▶ my ($self, $hook, $step, $pkg, @args) = @_;
Subroutine run_hook_as: called CC=4 SCAR=14.2
Pod documented
173 3 ▶ croak "Missing hook" if ! $hook;
Branch: 1 branch
BranchTrueFalseTotal
unless $hook 0 3 3
174 3 ▶ croak "Missing step" if ! $step;
Branch: 1 branch
BranchTrueFalseTotal
unless $step 0 3 3
175 3 ▶ croak "Missing package" if ! $pkg;
Branch: 1 branch
BranchTrueFalseTotal
unless $pkg 0 3 3
176 3 $self->morph($step, 2, $pkg);
177 3 my $resp = $self->run_hook($hook, $step, @args);
178 3 $self->unmorph;
179 3 return $resp;
180 }
181  
182 sub run_step {
183 111 ▶ my ($self, $step) = @_;
Subroutine run_step: called CC=7 SCAR=19.5
Pod documented
184 111 ▶ return 1 if $self->run_hook('pre_step', $step); # if true exit the nav_loop
Branch: 1 branch
BranchTrueFalseTotal
if $self->run_hook("pre_step", $step) 2 109 111
185 109 ▶ return 0 if $self->run_hook('skip', $step); # if true skip this step
Branch: 1 branch
BranchTrueFalseTotal
if $self->run_hook("skip", $step) 8 101 109
186  
187 # check for complete valid information for this step
188 101 ▶ if ( ! $self->run_hook('prepare', $step)
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->run_hook("prepare", $step) and $self->run_hook("info_complete", $step) and $self->run_hook("finalize", $step)) 72 28 100
Condition100%6/6
$self->run_hook("prepare", $step) and $self->run_hook("info_complete", $step) and $self->run_hook("finalize", $step)
!ll&&!rl&&r
68528
$self->run_hook("prepare", $step) and $self->run_hook("info_complete", $step)
!ll&&!rl&&r
16733
MC/DC100%3/3
$self->run_hook("prepare", $step) and $self->run_hook("info_complete", $step) and $self->run_hook("finalize", $step)
$self->run_hook("prepare", $step) $self->run_hook("info_complete", $step) $self->run_hook("finalize", $step)
Truth table100%4/4
A and B and C
A= $self->run_hook("prepare", $step)B= $self->run_hook("info_complete", $step)C= $self->run_hook("finalize", $step)
ABCresult
0XX0
10X0
1100
1111
189 || ! $self->run_hook('info_complete', $step)
190 || ! $self->run_hook('finalize', $step)) {
191  
192 73 $self->run_hook('prepared_print', $step); # show the page requesting the information
193 72 $self->run_hook('post_print', $step); # a hook after the printing process
194  
195 72 return 1;
196 }
197  
198 28 ▶ return 1 if $self->run_hook('post_step', $step); # if true exit the nav_loop
Branch: 1 branch
BranchTrueFalseTotal
if $self->run_hook("post_step", $step) 1 27 28
199 27 return 0; # let the nav_loop continue searching the path
200 }
201  
202 sub prepared_print {
203 73 ▶ my $self = shift;
Subroutine prepared_print: called CC=9 SCAR=22.0
Pod documented
204 73 my $step = shift;
205 73 ▶ my $hash_form = $self->run_hook('hash_form', $step) || {};
Condition100%2/2
$self->run_hook('hash_form', $step) || {}
l!l
721
MC/DC100%1/1
$self->run_hook('hash_form', $step) || {}
$self->run_hook('hash_form', $step)
Truth table100%2/2
A
A= $self->run_hook('hash_form', $step)
Aresult
11
00
206 73 ▶ my $hash_base = $self->run_hook('hash_base', $step) || {};
Condition100%2/2
$self->run_hook('hash_base', $step) || {}
l!l
721
MC/DC100%1/1
$self->run_hook('hash_base', $step) || {}
$self->run_hook('hash_base', $step)
Truth table100%2/2
A
A= $self->run_hook('hash_base', $step)
Aresult
11
00
207 73 ▶ my $hash_comm = $self->run_hook('hash_common', $step) || {};
Condition100%2/2
$self->run_hook('hash_common', $step) || {}
l!l
721
MC/DC100%1/1
$self->run_hook('hash_common', $step) || {}
$self->run_hook('hash_common', $step)
Truth table100%2/2
A
A= $self->run_hook('hash_common', $step)
Aresult
11
00
208 73 ▶ my $hash_swap = $self->run_hook('hash_swap', $step) || {};
Condition100%2/2
$self->run_hook('hash_swap', $step) || {}
l!l
711
MC/DC100%1/1
$self->run_hook('hash_swap', $step) || {}
$self->run_hook('hash_swap', $step)
Truth table100%2/2
A
A= $self->run_hook('hash_swap', $step)
Aresult
11
00
209 72 ▶ my $hash_fill = $self->run_hook('hash_fill', $step) || {};
Condition100%2/2
$self->run_hook('hash_fill', $step) || {}
l!l
711
MC/DC100%1/1
$self->run_hook('hash_fill', $step) || {}
$self->run_hook('hash_fill', $step)
Truth table100%2/2
A
A= $self->run_hook('hash_fill', $step)
Aresult
11
00
210 72 ▶ my $hash_errs = $self->run_hook('hash_errors', $step) || {};
Condition100%2/2
$self->run_hook('hash_errors', $step) || {}
l!l
711
MC/DC100%1/1
$self->run_hook('hash_errors', $step) || {}
$self->run_hook('hash_errors', $step)
Truth table100%2/2
A
A= $self->run_hook('hash_errors', $step)
Aresult
11
00
211 72 $hash_errs->{$_} = $self->format_error($hash_errs->{$_}) foreach keys %$hash_errs;
212 72 ▶ $hash_errs->{'has_errors'} = 1 if scalar keys %$hash_errs;
Branch: 1 branch
BranchTrueFalseTotal
if scalar keys %$hash_errs 4 68 72
213  
214 72 my $swap = {%$hash_form, %$hash_base, %$hash_comm, %$hash_swap, %$hash_errs};
215 72 my $fill = {%$hash_form, %$hash_base, %$hash_comm, %$hash_fill};
216 72 $self->run_hook('print', $step, $swap, $fill);
217 }
218  
219 sub print {
220 72 ▶ my ($self, $step, $swap, $fill) = @_;
Subroutine print: called CC=1 SCAR=0.0
Pod documented
221 72 my $file = $self->run_hook('file_print', $step); # get a filename relative to template_path
222 72 my $out = $self->run_hook('swap_template', $step, $file, $swap);
223 72 $self->run_hook('fill_template', $step, \$out, $fill);
224 72 $self->run_hook('print_out', $step, \$out);
225 }
226  
227 sub handle_error {
228 8 ▶ my ($self, $err) = @_;
Subroutine handle_error: called CC=5 SCAR=17.0
Pod documented
229 8 ▶ die $err if $self->{'_handling_error'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_handling_error"} 0 8 8
230 8 local @$self{'_handling_error', '_recurse' } = (1, 0); # allow for this next step - even if we hit a recurse error
231 8 $self->stash->{'error_step'} = $self->current_step;
232 6 $self->stash->{'error'} = $err;
233 6 eval {
234 6 my $step = $self->error_step;
235 6 $self->morph($step); # let steps be in external modules
236 6 ▶ $self->run_hook('run_step', $step) && $self->unmorph($step);
Branch: 1 branch
BranchTrueFalseTotal
$self->run_hook("run_step", $step) and $self->unmorph($step) 6 0 6
237 };
238 6 ▶ die $@ if $@ && $@ ne "Long Jump\n";
Branch: 1 branch
BranchTrueFalseTotal
if $@ and $@ ne "Long Jump\n" 0 6 6
Condition33%1/3
$@ and $@ ne "Long Jump\n"
!ll&&!rl&&r
600
MC/DC0%0/2
$@ and $@ ne "Long Jump\n"
$@ $@ ne "Long Jump\n"
Truth table33%1/3
A and B
A= $@B= $@ ne "Long Jump\n"
ABresult
0X0
100
111
239 }
240  
241 ###---------------------###
242 # read only accessors
243  
244 117 ▶sub allow_morph { $_[0]->{'allow_morph'} }
Subroutine allow_morph: called CC=1 SCAR=0.0
Pod documented
245 2 ▶sub auth_args { $_[0]->{'auth_args'} }
Subroutine auth_args: called CC=1 SCAR=0.0
Pod documented
246 11 ▶sub auth_obj { shift->{'auth_obj'} || do { require CGI::Ex::Auth; CGI::Ex::Auth->new(@_) } }
Subroutine auth_obj: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->{"auth_obj"} or do { require CGI::Ex::Auth; "CGI::Ex::Auth"->new(@_) } 11 0 11
247 5 ▶sub charset { $_[0]->{'charset'} || '' }
Subroutine charset: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"charset"} or "" 3 2 5
248 5 ▶sub conf_args { $_[0]->{'conf_args'} }
Subroutine conf_args: called CC=1 SCAR=0.0
Pod documented
249 2 ▶sub conf_die_on_fail { $_[0]->{'conf_die_on_fail'} || ! defined $_[0]->{'conf_die_on_fail'} }
Subroutine conf_die_on_fail: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"conf_die_on_fail"} or not defined $_[0]{"conf_die_on_fail"} 1 1 2
250 3 ▶sub conf_path { $_[0]->{'conf_path'} || $_[0]->base_dir_abs }
Subroutine conf_path: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"conf_path"} or $_[0]->base_dir_abs 2 1 3
251 4 ▶sub conf_validation { $_[0]->{'conf_validation'} }
Subroutine conf_validation: called CC=1 SCAR=0.0
Pod documented
252 60 ▶sub default_step { $_[0]->{'default_step'} || 'main' }
Subroutine default_step: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"default_step"} or "main" 59 1 60
253 8 ▶sub error_step { $_[0]->{'error_step'} || '__error' }
Subroutine error_step: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"error_step"} or "__error" 7 1 8
254 71 ▶sub fill_args { $_[0]->{'fill_args'} }
Subroutine fill_args: called CC=1 SCAR=0.0
Pod documented
255 5 ▶sub forbidden_step { $_[0]->{'forbidden_step'} || '__forbidden' }
Subroutine forbidden_step: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"forbidden_step"} or "__forbidden" 4 1 5
256 79 ▶sub form_name { $_[0]->{'form_name'} || 'theform' }
Subroutine form_name: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"form_name"} or "theform" 79 0 79
257 519 ▶sub history { $_[0]->{'history'} ||= [] }
Subroutine history: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{"history"} ||= []
l!l
44277
MC/DC100%1/1
$_[0]{"history"} ||= []
$_[0]{"history"}
Truth table100%2/2
A
A= $_[0]{"history"}
Aresult
11
00
258 18 ▶sub js_step { $_[0]->{'js_step'} || 'js' }
Subroutine js_step: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"js_step"} or "js" 17 1 18
259 9 ▶sub login_step { $_[0]->{'login_step'} || '__login' }
Subroutine login_step: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"login_step"} or "__login" 8 1 9
260 5 ▶sub mimetype { $_[0]->{'mimetype'} || 'text/html' }
Subroutine mimetype: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"mimetype"} or "text/html" 3 2 5
261 173 ▶sub path_info { $_[0]->{'path_info'} || $ENV{'PATH_INFO'} || '' }
Subroutine path_info: called CC=3 SCAR=11.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"path_info"} or $ENV{"PATH_INFO"} or "" 143 30 173
Condition100%3/3
$_[0]{"path_info"} or $ENV{"PATH_INFO"}
l!l&&r!l&&!r
228143
MC/DC100%2/2
$_[0]{"path_info"} or $ENV{"PATH_INFO"}
$_[0]{"path_info"} $ENV{"PATH_INFO"}
Truth table100%3/3
A or B
A= $_[0]{"path_info"}B= $ENV{"PATH_INFO"}
ABresult
1X1
011
000
262 80 ▶sub path_info_map_base { $_[0]->{'path_info_map_base'} ||[[qr{/(\w+)}, $_[0]->step_key]] }
Subroutine path_info_map_base: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"path_info_map_base"} or [[qr"/(\w+)", $_[0]->step_key]] 69 11 80
263 155 ▶sub recurse_limit { $_[0]->{'recurse_limit'} || 15 }
Subroutine recurse_limit: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"recurse_limit"} or 15 143 12 155
264 116 ▶sub script_name { $_[0]->{'script_name'} || $ENV{'SCRIPT_NAME'} || $0 }
Subroutine script_name: called CC=3 SCAR=11.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"script_name"} or $ENV{"SCRIPT_NAME"} or $0 29 87 116
Condition100%3/3
$_[0]{"script_name"} or $ENV{"SCRIPT_NAME"}
l!l&&r!l&&!r
78029
MC/DC100%2/2
$_[0]{"script_name"} or $ENV{"SCRIPT_NAME"}
$_[0]{"script_name"} $ENV{"SCRIPT_NAME"}
Truth table100%3/3
A or B
A= $_[0]{"script_name"}B= $ENV{"SCRIPT_NAME"}
ABresult
1X1
011
000
265 24 ▶sub stash { $_[0]->{'stash'} ||= {} }
Subroutine stash: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{"stash"} ||= {}
l!l
159
MC/DC100%1/1
$_[0]{"stash"} ||= {}
$_[0]{"stash"}
Truth table100%2/2
A
A= $_[0]{"stash"}
Aresult
11
00
266 224 ▶sub step_key { $_[0]->{'step_key'} || 'step' }
Subroutine step_key: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"step_key"} or "step" 223 1 224
267 74 ▶sub template_args { $_[0]->{'template_args'} }
Subroutine template_args: called CC=1 SCAR=0.0
Pod documented
268 73 ▶sub template_obj { shift->{'template_obj'} || do { require Template::Alloy; Template::Alloy->new(@_) } }
Subroutine template_obj: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->{"template_obj"} or do { require Template::Alloy; "Template::Alloy"->new(@_) } 72 1 73
269 78 ▶sub template_path { $_[0]->{'template_path'} || $_[0]->base_dir_abs }
Subroutine template_path: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"template_path"} or $_[0]->base_dir_abs 77 1 78
270 16 ▶sub val_args { $_[0]->{'val_args'} }
Subroutine val_args: called CC=1 SCAR=0.0
Pod undocumented
271 10 ▶sub val_path { $_[0]->{'val_path'} || $_[0]->template_path }
Subroutine val_path: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"val_path"} or $_[0]->template_path 5 5 10
272  
273 sub conf_obj {
274 4 ▶ my $self = shift;
Subroutine conf_obj: called CC=5 SCAR=16.2
Pod documented
275 4 ▶ return $self->{'conf_obj'} || do {
Condition66%2/3
$self->{'conf_obj'} || do { my $args = $self->conf_args || {}; $args->{'paths'} ||= $self->conf_path; $args->{'directive'} ||= 'MERGE'; require CGI::Ex::Conf; 'CGI::Ex::Conf'->new($args) }
l!l&&r!l&&!r
130
MC/DC0%0/2
$self->{'conf_obj'} || do { my $args = $self->conf_args || {}; $args->{'paths'} ||= $self->conf_path; $args->{'directive'} ||= 'MERGE'; require CGI::Ex::Conf; 'CGI::Ex::Conf'->new($args) }
$self->{'conf_obj'} do { my $args = $self->conf_args || {}; $args->{'paths'} ||= $self->conf_path; $args->{'directive'} ||= 'MERGE'; require CGI::Ex::Conf; 'CGI::Ex::Conf'->new($args) }
Truth table66%2/3
A || B
A= $self->{'conf_obj'}B= do { my $args = $self->conf_args || {}; $args->{'paths'} ||= $self->conf_path; $args->{'directive'} ||= 'MERGE'; require CGI::Ex::Conf; 'CGI::Ex::Conf'->new($args) }
ABresult
1X1
011
000
276 3 ▶ my $args = $self->conf_args || {};
Condition100%2/2
$self->conf_args || {}
l!l
12
MC/DC100%1/1
$self->conf_args || {}
$self->conf_args
Truth table100%2/2
A
A= $self->conf_args
Aresult
11
00
277 3 ▶ $args->{'paths'} ||= $self->conf_path;
Condition66%2/3
$args->{"paths"} ||= $self->conf_path
l!l&&r!l&&!r
120
MC/DC0%0/2
$args->{"paths"} ||= $self->conf_path
$args->{"paths"} $self->conf_path
Truth table66%2/3
A ||= B
A= $args->{"paths"}B= $self->conf_path
ABresult
1X1
011
000
278 3 ▶ $args->{'directive'} ||= 'MERGE';
Condition100%2/2
$args->{"directive"} ||= "MERGE"
l!l
12
MC/DC100%1/1
$args->{"directive"} ||= "MERGE"
$args->{"directive"}
Truth table100%2/2
A
A= $args->{"directive"}
Aresult
11
00
279 3 require CGI::Ex::Conf;
280 3 CGI::Ex::Conf->new($args);
281 };
282 }
283  
284 sub val_obj {
285 15 ▶ my $self = shift;
Subroutine val_obj: called CC=4 SCAR=14.0
Pod undocumented
286 15 ▶ return $self->{'val_obj'} || do {
Condition66%2/3
$self->{'val_obj'} || do { my $args = $self->val_args || {}; $args->{'cgix'} ||= $self->cgix; require CGI::Ex::Validate; 'CGI::Ex::Validate'->new($args) }
l!l&&r!l&&!r
1140
MC/DC0%0/2
$self->{'val_obj'} || do { my $args = $self->val_args || {}; $args->{'cgix'} ||= $self->cgix; require CGI::Ex::Validate; 'CGI::Ex::Validate'->new($args) }
$self->{'val_obj'} do { my $args = $self->val_args || {}; $args->{'cgix'} ||= $self->cgix; require CGI::Ex::Validate; 'CGI::Ex::Validate'->new($args) }
Truth table66%2/3
A || B
A= $self->{'val_obj'}B= do { my $args = $self->val_args || {}; $args->{'cgix'} ||= $self->cgix; require CGI::Ex::Validate; 'CGI::Ex::Validate'->new($args) }
ABresult
1X1
011
000
287 14 ▶ my $args = $self->val_args || {};
Condition100%2/2
$self->val_args || {}
l!l
113
MC/DC100%1/1
$self->val_args || {}
$self->val_args
Truth table100%2/2
A
A= $self->val_args
Aresult
11
00
288 14 ▶ $args->{'cgix'} ||= $self->cgix;
Condition66%2/3
$args->{"cgix"} ||= $self->cgix
l!l&&r!l&&!r
1130
MC/DC0%0/2
$args->{"cgix"} ||= $self->cgix
$args->{"cgix"} $self->cgix
Truth table66%2/3
A ||= B
A= $args->{"cgix"}B= $self->cgix
ABresult
1X1
011
000
289 14 require CGI::Ex::Validate;
290 14 CGI::Ex::Validate->new($args);
291 };
292 }
293  
294 ###---------------------###
295 # read/write accessors
296  
297 143 ▶sub auth_data { (@_ == 2) ? $_[0]->{'auth_data'} = pop : $_[0]->{'auth_data'} }
Subroutine auth_data: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 4 139 143
298 82 ▶sub base_dir_abs { (@_ == 2) ? $_[0]->{'base_dir_abs'} = pop : $_[0]->{'base_dir_abs'} || ['.'] }
Subroutine base_dir_abs: called CC=3 SCAR=11.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 1 81 82
Condition100%2/2
$_[0]{"base_dir_abs"} or ["."]
l!l
279
MC/DC100%1/1
$_[0]{"base_dir_abs"} or ["."]
$_[0]{"base_dir_abs"}
Truth table100%2/2
A
A= $_[0]{"base_dir_abs"}
Aresult
11
00
299 19 ▶sub base_dir_rel { (@_ == 2) ? $_[0]->{'base_dir_rel'} = pop : $_[0]->{'base_dir_rel'} || '' }
Subroutine base_dir_rel: called CC=3 SCAR=11.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 1 18 19
Condition100%2/2
$_[0]{"base_dir_rel"} or ""
l!l
216
MC/DC100%1/1
$_[0]{"base_dir_rel"} or ""
$_[0]{"base_dir_rel"}
Truth table100%2/2
A
A= $_[0]{"base_dir_rel"}
Aresult
11
00
300 14 ▶sub cgix { (@_ == 2) ? $_[0]->{'cgix'} = pop : $_[0]->{'cgix'} ||= do { require CGI::Ex; CGI::Ex->new } }
Subroutine cgix: called CC=3 SCAR=11.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 1 13 14
Condition66%2/3
@_ == 2 ? $_[0]{"cgix"} = pop() : $_[0]{"cgix"} ||= do { require CGI::Ex; "CGI::Ex"->new }
l!l&&r!l&&!r
1310
MC/DC0%0/2
@_ == 2 ? $_[0]{"cgix"} = pop() : $_[0]{"cgix"} ||= do { require CGI::Ex; "CGI::Ex"->new }
@_ == 2 ? $_[0]{"cgix"} = pop() : $_[0]{"cgix"} do { require CGI::Ex; "CGI::Ex"->new }
Truth table66%2/3
A ||= B
A= @_ == 2 ? $_[0]{"cgix"} = pop() : $_[0]{"cgix"}B= do { require CGI::Ex; "CGI::Ex"->new }
ABresult
1X1
011
000
301 3 ▶sub cookies { (@_ == 2) ? $_[0]->{'cookies'} = pop : $_[0]->{'cookies'} ||= $_[0]->cgix->get_cookies }
Subroutine cookies: called CC=3 SCAR=12.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 1 2 3
Condition33%1/3
@_ == 2 ? $_[0]{"cookies"} = pop() : $_[0]{"cookies"} ||= $_[0]->cgix->get_cookies
l!l&&r!l&&!r
300
MC/DC0%0/2
@_ == 2 ? $_[0]{"cookies"} = pop() : $_[0]{"cookies"} ||= $_[0]->cgix->get_cookies
@_ == 2 ? $_[0]{"cookies"} = pop() : $_[0]{"cookies"} $_[0]->cgix->get_cookies
Truth table33%1/3
A ||= B
A= @_ == 2 ? $_[0]{"cookies"} = pop() : $_[0]{"cookies"}B= $_[0]->cgix->get_cookies
ABresult
1X1
011
000
302 6 ▶sub ext_conf { (@_ == 2) ? $_[0]->{'ext_conf'} = pop : $_[0]->{'ext_conf'} || 'pl' }
Subroutine ext_conf: called CC=3 SCAR=11.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 1 5 6
Condition100%2/2
$_[0]{"ext_conf"} or "pl"
l!l
32
MC/DC100%1/1
$_[0]{"ext_conf"} or "pl"
$_[0]{"ext_conf"}
Truth table100%2/2
A
A= $_[0]{"ext_conf"}
Aresult
11
00
303 7 ▶sub ext_print { (@_ == 2) ? $_[0]->{'ext_print'} = pop : $_[0]->{'ext_print'} || 'html' }
Subroutine ext_print: called CC=3 SCAR=11.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 1 6 7
Condition100%2/2
$_[0]{"ext_print"} or "html"
l!l
24
MC/DC100%1/1
$_[0]{"ext_print"} or "html"
$_[0]{"ext_print"}
Truth table100%2/2
A
A= $_[0]{"ext_print"}
Aresult
11
00
304 11 ▶sub ext_val { (@_ == 2) ? $_[0]->{'ext_val'} = pop : $_[0]->{'ext_val'} || 'val' }
Subroutine ext_val: called CC=3 SCAR=11.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 1 10 11
Condition100%2/2
$_[0]{"ext_val"} or "val"
l!l
28
MC/DC100%1/1
$_[0]{"ext_val"} or "val"
$_[0]{"ext_val"}
Truth table100%2/2
A
A= $_[0]{"ext_val"}
Aresult
11
00
305 11 ▶sub form { (@_ == 2) ? $_[0]->{'form'} = pop : $_[0]->{'form'} ||= $_[0]->cgix->get_form }
Subroutine form: called CC=3 SCAR=11.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 1 10 11
Condition66%2/3
@_ == 2 ? $_[0]{"form"} = pop() : $_[0]{"form"} ||= $_[0]->cgix->get_form
l!l&&r!l&&!r
740
MC/DC0%0/2
@_ == 2 ? $_[0]{"form"} = pop() : $_[0]{"form"} ||= $_[0]->cgix->get_form
@_ == 2 ? $_[0]{"form"} = pop() : $_[0]{"form"} $_[0]->cgix->get_form
Truth table66%2/3
A ||= B
A= @_ == 2 ? $_[0]{"form"} = pop() : $_[0]{"form"}B= $_[0]->cgix->get_form
ABresult
1X1
011
000
306 195 ▶sub load_conf { (@_ == 2) ? $_[0]->{'load_conf'} = pop : $_[0]->{'load_conf'} }
Subroutine load_conf: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 1 194 195
307  
308 sub conf {
309 8 ▶ my $self = shift;
Subroutine conf: called CC=9 SCAR=22.2
Pod documented
310 8 ▶ $self->{'conf'} = pop if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 1 7 8
311 8 ▶ return $self->{'conf'} ||= do {
Condition66%2/3
$self->{"conf"} ||= do { my $conf = $self->conf_file; $conf = $self->conf_obj->read($conf, {"no_warn_on_fail", 1}) || ($self->conf_die_on_fail ? croak($@) : {}) unless ref $conf; my $hash = $self->conf_validation; if ($hash and scalar keys %$hash) { my $err_obj = $self->val_obj->validate($conf, $hash); croak("$err_obj") if $err_obj; } ; $conf }
l!l&&r!l&&!r
440
MC/DC0%0/2
$self->{"conf"} ||= do { my $conf = $self->conf_file; $conf = $self->conf_obj->read($conf, {"no_warn_on_fail", 1}) || ($self->conf_die_on_fail ? croak($@) : {}) unless ref $conf; my $hash = $self->conf_validation; if ($hash and scalar keys %$hash) { my $err_obj = $self->val_obj->validate($conf, $hash); croak("$err_obj") if $err_obj; } ; $conf }
$self->{"conf"} do { my $conf = $self->conf_file; $conf = $self->conf_obj->read($conf, {"no_warn_on_fail", 1}) || ($self->conf_die_on_fail ? croak($@) : {}) unless ref $conf; my $hash = $self->conf_validation; if ($hash and scalar keys %$hash) { my $err_obj = $self->val_obj->validate($conf, $hash); croak("$err_obj") if $err_obj; } ; $conf }
Truth table66%2/3
A ||= B
A= $self->{"conf"}B= do { my $conf = $self->conf_file; $conf = $self->conf_obj->read($conf, {"no_warn_on_fail", 1}) || ($self->conf_die_on_fail ? croak($@) : {}) unless ref $conf; my $hash = $self->conf_validation; if ($hash and scalar keys %$hash) { my $err_obj = $self->val_obj->validate($conf, $hash); croak("$err_obj") if $err_obj; } ; $conf }
ABresult
1X1
011
000
312 4 my $conf = $self->conf_file;
313 4 ▶ $conf = $self->conf_obj->read($conf, {no_warn_on_fail => 1}) || ($self->conf_die_on_fail ? croak $@ : {})
Branch: 2 branches
BranchTrueFalseTotal
unless ref $conf 1 3 4
$self->conf_die_on_fail ? : 1 0 1
Condition33%1/3
$self->conf_obj->read($conf, {'no_warn_on_fail', 1}) || ($self->conf_die_on_fail ? croak($@) : {})
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->conf_obj->read($conf, {'no_warn_on_fail', 1}) || ($self->conf_die_on_fail ? croak($@) : {})
$self->conf_obj->read($conf, {'no_warn_on_fail', 1}) ($self->conf_die_on_fail ? croak($@) : {})
Truth table33%1/3
A || B
A= $self->conf_obj->read($conf, {'no_warn_on_fail', 1})B= ($self->conf_die_on_fail ? croak($@) : {})
ABresult
1X1
011
000
314 if ! ref $conf;
315 3 my $hash = $self->conf_validation;
316 3 ▶ if ($hash && scalar keys %$hash) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hash and scalar keys %$hash) 2 1 3
Condition100%2/2
$hash and scalar keys %$hash
!ll
12
MC/DC100%1/1
$hash and scalar keys %$hash
$hash
Truth table100%2/2
A
A= $hash
Aresult
00
11
317 2 my $err_obj = $self->val_obj->validate($conf, $hash);
318 2 ▶ croak "$err_obj" if $err_obj;
Branch: 1 branch
BranchTrueFalseTotal
if $err_obj 1 1 2
319 }
320 2 $conf;
321 }
322 }
323  
324 sub conf_file {
325 10 ▶ my $self = shift;
Subroutine conf_file: called CC=4 SCAR=14.0
Pod documented
326 10 ▶ $self->{'conf_file'} = pop if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 1 9 10
327 10 ▶ return $self->{'conf_file'} ||= do {
Condition66%2/3
$self->{"conf_file"} ||= do { my $module = $self->name_module || croak("Missing name_module during conf_file call"); $module . '.' . $self->ext_conf }
l!l&&r!l&&!r
640
MC/DC0%0/2
$self->{"conf_file"} ||= do { my $module = $self->name_module || croak("Missing name_module during conf_file call"); $module . '.' . $self->ext_conf }
$self->{"conf_file"} do { my $module = $self->name_module || croak("Missing name_module during conf_file call"); $module . '.' . $self->ext_conf }
Truth table66%2/3
A ||= B
A= $self->{"conf_file"}B= do { my $module = $self->name_module || croak("Missing name_module during conf_file call"); $module . '.' . $self->ext_conf }
ABresult
1X1
011
000
328 4 ▶ my $module = $self->name_module || croak 'Missing name_module during conf_file call';
Condition66%2/3
$self->name_module || croak('Missing name_module during conf_file call')
l!l&&r!l&&!r
310
MC/DC0%0/2
$self->name_module || croak('Missing name_module during conf_file call')
$self->name_module croak('Missing name_module during conf_file call')
Truth table33%1/3
A || B
A= $self->name_moduleB= croak('Missing name_module during conf_file call')
ABresult
1X1
011
000
329 3 $module .'.'. $self->ext_conf;
330 };
331 }
332  
333 ###---------------------###
334 # general methods
335  
336 2 ▶sub add_to_base { my $self = shift; $self->add_to_hash($self->hash_base, @_) }
Subroutine add_to_base: called CC=1 SCAR=0.0
Pod undocumented
337 2 ▶sub add_to_common { my $self = shift; $self->add_to_hash($self->hash_common, @_) }
Subroutine add_to_common: called CC=1 SCAR=0.0
Pod undocumented
338 3 ▶sub add_to_errors { shift->add_errors(@_) }
Subroutine add_to_errors: called CC=1 SCAR=0.0
Pod undocumented
339 2 ▶sub add_to_fill { my $self = shift; $self->add_to_hash($self->hash_fill, @_) }
Subroutine add_to_fill: called CC=1 SCAR=0.0
Pod undocumented
340 2 ▶sub add_to_form { my $self = shift; $self->add_to_hash($self->hash_form, @_) }
Subroutine add_to_form: called CC=1 SCAR=0.0
Pod undocumented
341 1 ▶sub add_to_path { shift->append_path(@_) } # legacy
Subroutine add_to_path: called CC=1 SCAR=0.0
Pod undocumented
342 2 ▶sub add_to_swap { my $self = shift; $self->add_to_hash($self->hash_swap, @_) }
Subroutine add_to_swap: called CC=1 SCAR=0.0
Pod undocumented
343 7 ▶sub append_path { my $self = shift; push @{ $self->path }, @_ }
Subroutine append_path: called CC=1 SCAR=0.0
Pod documented
344 3 ▶sub cleanup_user { my ($self, $user) = @_; $user }
Subroutine cleanup_user: called CC=1 SCAR=0.0
Pod documented
345 10 ▶sub current_step { $_[0]->step_by_path_index($_[0]->{'path_i'} || 0) }
Subroutine current_step: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{'path_i'} || 0
l!l
46
MC/DC100%1/1
$_[0]{'path_i'} || 0
$_[0]{'path_i'}
Truth table100%2/2
A
A= $_[0]{'path_i'}
Aresult
11
00
346 ▶sub destroy {}
Subroutine destroy: called CC=1 SCAR=0.0
Pod documented
347 2 ▶sub first_step { $_[0]->step_by_path_index(0) }
Subroutine first_step: called CC=1 SCAR=0.0
Pod documented
348 ▶sub fixup_after_morph {}
Subroutine fixup_after_morph: called CC=1 SCAR=0.0
Pod undocumented
349 ▶sub fixup_before_unmorph {}
Subroutine fixup_before_unmorph: called CC=1 SCAR=0.0
Pod undocumented
350 8 ▶sub format_error { my ($self, $error) = @_; $error }
Subroutine format_error: called CC=1 SCAR=0.0
Pod undocumented
351 1 ▶sub get_pass_by_user { croak "get_pass_by_user is a virtual method and needs to be overridden for authentication to work" }
Subroutine get_pass_by_user: called CC=1 SCAR=0.0
Pod documented
352 1 ▶sub has_errors { scalar keys %{ $_[0]->hash_errors } }
Subroutine has_errors: called CC=1 SCAR=0.0
Pod undocumented
353 2 ▶sub last_step { $_[0]->step_by_path_index($#{ $_[0]->path }) }
Subroutine last_step: called CC=1 SCAR=0.0
Pod documented
354 ▶sub path_info_map {}
Subroutine path_info_map: called CC=1 SCAR=0.0
Pod documented
355 56 ▶sub post_loop { 0 } # true value means to abort the nav_loop - don't recurse
Subroutine post_loop: called CC=1 SCAR=0.0
Pod documented
356 ▶sub post_navigate {}
Subroutine post_navigate: called CC=1 SCAR=0.0
Pod documented
357 148 ▶sub pre_loop { 0 } # true value means to abort the nav_loop routine
Subroutine pre_loop: called CC=1 SCAR=0.0
Pod documented
358 73 ▶sub pre_navigate { 0 } # true means to not enter nav_loop
Subroutine pre_navigate: called CC=1 SCAR=0.0
Pod documented
359 3 ▶sub previous_step { $_[0]->step_by_path_index(($_[0]->{'path_i'} || 0) - 1) }
Subroutine previous_step: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{'path_i'} || 0
l!l
21
MC/DC100%1/1
$_[0]{'path_i'} || 0
$_[0]{'path_i'}
Truth table100%2/2
A
A= $_[0]{'path_i'}
Aresult
11
00
360 ▶sub valid_steps {}
Subroutine valid_steps: called CC=1 SCAR=0.0
Pod documented
361 3 ▶sub verify_user { 1 }
Subroutine verify_user: called CC=1 SCAR=0.0
Pod documented
362  
363 sub add_errors {
364 7 ▶ my $self = shift;
Subroutine add_errors: called CC=5 SCAR=16.1
Pod undocumented
365 7 my $hash = $self->hash_errors;
366 7 ▶ my $args = ref($_[0]) ? shift : {@_};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 6 1 7
367 7 foreach my $key (keys %$args) {
368 7 ▶ my $_key = ($key =~ /error$/) ? $key : "${key}_error";
Branch: 1 branch
BranchTrueFalseTotal
$key =~ /error$/ ? : 4 3 7
369 7 ▶ if ($hash->{$_key}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hash->{$_key}) { } 1 6 7
370 1 $hash->{$_key} .= '<br>' . $args->{$key};
371 } else {
372 6 $hash->{$_key} = $args->{$key};
373 }
374 }
375 7 $hash->{'has_errors'} = 1;
376 }
377  
378 sub add_to_hash {
379 10 ▶ my $self = shift;
Subroutine add_to_hash: called CC=2 SCAR=6.9
Pod undocumented
380 10 my $old = shift;
381 10 ▶ my $new = ref($_[0]) ? shift : {@_};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 5 5 10
382 10 @$old{keys %$new} = values %$new;
383 }
384  
385 sub clear_app {
386 1 ▶ my $self = shift;
Subroutine clear_app: called CC=1 SCAR=0.0
Pod documented
387 1 delete @$self{qw(cgix cookies form hash_common hash_errors hash_fill hash_swap history
388 _morph_lineage _morph_lineage_start_index path path_i stash val_obj)};
389 1 return $self;
390 }
391  
392 sub dump_history {
393 3 ▶ my ($self, $all) = @_;
Subroutine dump_history: called CC=14 SCAR=26.4
Pod documented
394 3 my $hist = $self->history;
395 3 my $dump = [sprintf "Elapsed: %.5f", time - $self->{'_time'}];
396  
397 3 foreach my $row (@$hist) {
398 33 ▶ if (! ref($row) || ref($row) ne 'HASH' || ! exists $row->{'elapsed'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $row or ref $row ne "HASH" or not exists $row->{"elapsed"}) 6 24 30
Condition100%6/6
not ref $row or ref $row ne "HASH" or not exists $row->{"elapsed"}
l!l&&r!l&&!r
6324
not ref $row or ref $row ne "HASH"
l!l&&r!l&&!r
3327
MC/DC100%3/3
not ref $row or ref $row ne "HASH" or not exists $row->{"elapsed"}
not ref $row ref $row ne "HASH" not exists $row->{"elapsed"}
Truth table100%4/4
not(A) or B or not(C)
A= not ref $rowB= ref $row ne "HASH"C= not exists $row->{"elapsed"}
ABCresult
1XX1
01X1
0011
0000
399 9 push @$dump, $row;
400 9 next;
401 }
402 my $note = (' ' x ($row->{'level'} || 0))
403 24 ▶ . join(' - ', $row->{'step'}, $row->{'meth'}, $row->{'found'}, sprintf '%.5f', $row->{'elapsed'});
Condition50%1/2
$row->{'level'} || 0
l!l
024
MC/DC0%0/1
$row->{'level'} || 0
$row->{'level'}
Truth table50%1/2
A
A= $row->{'level'}
Aresult
11
00
404 24 my $resp = $row->{'response'};
405 24 ▶ if ($all) {
Branch: 1 branch
BranchTrueFalseTotal
if ($all) { } 16 8 24
406 16 $note = [$note, $resp];
407 } else {
408 8 ▶ $note .= ' - '
Branch: 4 branches
BranchTrueFalseTotal
!defined($resp) ? : 2 6 8
ref $resp eq 'ARRAY' && !@$resp ? : 1 5 6
ref $resp eq 'HASH' && !scalar(keys %$resp) ? : 1 4 5
$resp =~ /^(.{30}|.{0,30}(?=\n))(?s:.)/ ? : 1 3 4
Condition100%6/6
ref $resp eq "ARRAY" and not @$resp
!ll&&!rl&&r
411
ref $resp eq "HASH" and not scalar keys %$resp
!ll&&!rl&&r
311
MC/DC100%2/2
ref $resp eq "ARRAY" and not @$resp
ref $resp eq "ARRAY" not @$resp
MC/DC100%2/2
ref $resp eq "HASH" and not scalar keys %$resp
ref $resp eq "HASH" not scalar keys %$resp
Truth table100%3/3
A and not(B)
A= ref $resp eq "ARRAY"B= not @$resp
ABresult
0X0
100
111
Truth table100%3/3
A and not(B)
A= ref $resp eq "HASH"B= not scalar keys %$resp
ABresult
0X0
100
111
409 .(! defined $resp ? 'undef'
410 : ref($resp) eq 'ARRAY' && !@$resp ? '[]'
411 : ref($resp) eq 'HASH' && !scalar keys %$resp ? '{}'
412 : $resp =~ /^(.{30}|.{0,30}(?=\n))(?s:.)/ ? "$1..." : $resp);
413 8 ▶ $note .= ' - '.$row->{'info'} if defined $row->{'info'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $row->{"info"} 0 8 8
414 }
415 24 push @$dump, $note;
416 }
417  
418 3 return $dump;
419 }
420  
421 sub exit_nav_loop {
422 14 ▶ my $self = shift;
Subroutine exit_nav_loop: called CC=4 SCAR=13.9
Pod documented
423 14 ▶ if (my $ref = $self->{'_morph_lineage'}) { # undo morphs
Branch: 1 branch
BranchTrueFalseTotal
if (my $ref = $self->{"_morph_lineage"}) 2 12 14
424 2 my $index = $self->{'_morph_lineage_start_index'}; # allow for early "morphers" to only get rolled back so far
425 2 ▶ $index = -1 if ! defined $index;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $index 1 1 2
426 2 ▶ $self->unmorph while $#$ref != $index;
Branch: 1 branch
BranchTrueFalseTotal
$ref->$#* != $index and do { $self->unmorph } 1 2 3
427 }
428 14 die "Long Jump\n";
429 }
430  
431 sub insert_path {
432 57 ▶ my $self = shift;
Subroutine insert_path: called CC=3 SCAR=11.0
Pod documented
433 57 my $ref = $self->path;
434 57 ▶ my $i = $self->{'path_i'} || 0;
Condition100%2/2
$self->{'path_i'} || 0
l!l
2631
MC/DC100%1/1
$self->{'path_i'} || 0
$self->{'path_i'}
Truth table100%2/2
A
A= $self->{'path_i'}
Aresult
11
00
435 57 ▶ if ($i + 1 > $#$ref) { push @$ref, @_ }
Branch: 1 branch
BranchTrueFalseTotal
if ($i + 1 > $ref->$#*) { } 56 1 57
436 1 else { splice(@$ref, $i + 1, 0, @_) } # insert a path at the current location
437 }
438  
439 9 ▶sub jump { shift->goto_step(@_) }
Subroutine jump: called CC=1 SCAR=0.0
Pod documented
440  
441 sub goto_step {
442 20 ▶ my $self = shift;
Subroutine goto_step: called CC=18 SCAR=28.9
Pod documented
443 20 ▶ my $i = @_ == 1 ? shift : 1;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 20 0 20
444 20 my $path = $self->path;
445 20 ▶ my $path_i = $self->{'path_i'} || 0;
Condition100%2/2
$self->{'path_i'} || 0
l!l
812
MC/DC100%1/1
$self->{'path_i'} || 0
$self->{'path_i'}
Truth table100%2/2
A
A= $self->{'path_i'}
Aresult
11
00
446  
447 20 ▶ if ( $i eq 'FIRST' ) { $i = - $path_i - 1 }
Branch: 6 branches
BranchTrueFalseTotal
if ($i eq 'FIRST') { } 2 18 20
elsif ($i eq 'LAST') { } 1 17 18
elsif ($i eq 'NEXT') { } 1 16 17
elsif ($i eq 'CURRENT') { } 1 15 16
elsif ($i eq 'PREVIOUS') { } 1 14 15
elsif (not $i =~ /^-?\d+/) { } 11 3 14
448 1 elsif ($i eq 'LAST' ) { $i = $#$path - $path_i }
449 1 elsif ($i eq 'NEXT' ) { $i = 1 }
450 1 elsif ($i eq 'CURRENT' ) { $i = 0 }
451 1 elsif ($i eq 'PREVIOUS') { $i = -1 }
452 elsif ($i !~ /^-?\d+/) { # look for a step by that name in the current remaining path
453 11 my $found;
454 11 ▶ for (my $j = $path_i; $j < @$path; $j++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < @$path) 16 10 26
455 16 ▶ if ($path->[$j] eq $i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($path->[$j] eq $i) 1 15 16
456 1 $i = $j - $path_i;
457 1 $found = 1;
458 1 last;
459 }
460 }
461 11 ▶ if (! $found) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($found) 10 1 11
462 10 $self->replace_path($i);
463 10 $i = $#$path;
464 }
465 }
466 20 ▶ croak "Invalid jump index ($i)" if $i !~ /^-?\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $i =~ /^-?\d+$/ 0 20 20
467  
468 20 my $cut_i = $path_i + $i; # manipulate the path to contain the new jump location
469 20 ▶ my @replace = ($cut_i > $#$path) ? $self->default_step
Branch: 2 branches
BranchTrueFalseTotal
$cut_i > $path->$#* ? : 1 19 20
$cut_i < 0 ? : 3 16 19
470 : ($cut_i < 0) ? @$path
471 : @$path[$cut_i .. $#$path];
472 20 $self->replace_path(@replace);
473  
474 20 ▶ $self->{'jumps'} = ($self->{'jumps'} || 0) + 1;
Condition100%2/2
$self->{'jumps'} || 0
l!l
812
MC/DC100%1/1
$self->{'jumps'} || 0
$self->{'jumps'}
Truth table100%2/2
A
A= $self->{'jumps'}
Aresult
11
00
475 20 $self->{'path_i'}++; # move along now that the path is updated
476  
477 20 ▶ my $lin = $self->{'_morph_lineage'} || [];
Condition100%2/2
$self->{'_morph_lineage'} || []
l!l
119
MC/DC100%1/1
$self->{'_morph_lineage'} || []
$self->{'_morph_lineage'}
Truth table100%2/2
A
A= $self->{'_morph_lineage'}
Aresult
11
00
478 20 ▶ $self->unmorph if @$lin;
Branch: 1 branch
BranchTrueFalseTotal
if @$lin 1 19 20
479 20 $self->nav_loop; # recurse on the path
480 12 $self->exit_nav_loop;
481 }
482  
483 sub js_uri_path {
484 13 ▶ my $self = shift;
Subroutine js_uri_path: called CC=3 SCAR=12.0
Pod documented
485 13 my $script = $self->script_name;
486 13 my $js_step = $self->js_step;
487 13 ▶ return ($self->can('path') == \&CGI::Ex::App::path
Branch: 1 branch
BranchTrueFalseTotal
$self->can('path') == \&CGI::Ex::App::path && $self->can('path_info_map_base') == \&CGI::Ex::App::path_info_map_base ? : 13 0 13
Condition33%1/3
$self->can("path") == \&CGI::Ex::App::path and $self->can("path_info_map_base") == \&CGI::Ex::App::path_info_map_base
!ll&&!rl&&r
0013
MC/DC0%0/2
$self->can("path") == \&CGI::Ex::App::path and $self->can("path_info_map_base") == \&CGI::Ex::App::path_info_map_base
$self->can("path") == \&CGI::Ex::App::path $self->can("path_info_map_base") == \&CGI::Ex::App::path_info_map_base
Truth table33%1/3
A and B
A= $self->can("path") == \&CGI::Ex::App::pathB= $self->can("path_info_map_base") == \&CGI::Ex::App::path_info_map_base
ABresult
0X0
100
111
488 && $self->can('path_info_map_base') == \&CGI::Ex::App::path_info_map_base)
489 ? $script .'/'. $js_step # try to use a cache friendly URI (if path is our own)
490 : $script .'?'. $self->step_key .'='. $js_step .'&js='; # use one that works with more paths
491 }
492  
493  
494 sub morph {
495 133 ▶ my $self = shift;
Subroutine morph: called CC=20 SCAR=30.2
Pod documented
496 133 my $ref = $self->history->[-1];
497 133 ▶ if (! $ref || ! $ref->{'meth'} || $ref->{'meth'} ne 'morph') {
Branch: 1 branch
BranchTrueFalseTotal
if (not $ref && $ref->{"meth"} or $ref->{"meth"} ne "morph") 115 18 133
Condition83%5/6
not $ref && $ref->{"meth"} or $ref->{"meth"} ne "morph"
l!l&&r!l&&!r
763918
$ref && $ref->{'meth'}
!ll&&!rl&&r
76057
MC/DC66%2/3
not $ref && $ref->{"meth"} or $ref->{"meth"} ne "morph"
$ref $ref->{'meth'} $ref->{"meth"} ne "morph"
Truth table75%3/4
not(A && B) or C
A= $refB= $ref->{'meth'}C= $ref->{"meth"} ne "morph"
ABCresult
0XX1
10X1
1111
1100
498 115 push @{ $self->history }, ($ref = {meth => 'morph', found => 'morph', elapsed => 0, step => 'unknown', level => $self->{'_level'}});
499 }
500 133 ▶ my $step = shift || return;
Condition100%2/2
shift() || (return)
l!l
1321
MC/DC100%1/1
shift() || (return)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
501 132 ▶ my $allow = shift || $self->run_hook('allow_morph', $step) || return;
Condition100%5/5
shift() || $self->run_hook('allow_morph', $step) || (return)
l!l
21111
shift() or $self->run_hook("allow_morph", $step)
l!l&&r!l&&!r
417111
MC/DC100%2/2
shift() || $self->run_hook('allow_morph', $step) || (return)
shift() $self->run_hook("allow_morph", $step)
Truth table100%3/3
A or B
A= shift()B= $self->run_hook("allow_morph", $step)
ABresult
1X1
011
000
502 21 my $new = shift; # optionally allow passing in the package to morph to
503 21 ▶ my $lin = $self->{'_morph_lineage'} ||= [];
Condition100%2/2
$self->{"_morph_lineage"} ||= []
l!l
417
MC/DC100%1/1
$self->{"_morph_lineage"} ||= []
$self->{"_morph_lineage"}
Truth table100%2/2
A
A= $self->{"_morph_lineage"}
Aresult
11
00
504 21 my $ok = 0;
505 21 my $cur = ref $self;
506  
507 21 push @$lin, $cur; # store so subsequent unmorph calls can do the right thing
508  
509 # hash - but no step - record for unbless
510 21 ▶ if (ref($allow) && ! ($allow = $allow->{$step})) {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $allow and not $allow = $allow->{$step}) { } 1 20 21
elsif (not $new ||= $self->run_hook('morph_package', $step)) { } 0 20 20
elsif ($cur eq $new) { } 2 18 20
Condition100%3/3
ref $allow and not $allow = $allow->{$step}
!ll&&!rl&&r
1911
MC/DC100%2/2
ref $allow and not $allow = $allow->{$step}
ref $allow not $allow = $allow->{$step}
Truth table100%3/3
A and not(B)
A= ref $allowB= not $allow = $allow->{$step}
ABresult
0X0
100
111
511 1 $ref->{'info'} = "not allowed to morph to that step";
512  
513 ▶ } elsif (! ($new ||= $self->run_hook('morph_package', $step))) {
Condition66%2/3
$new ||= $self->run_hook("morph_package", $step)
l!l&&r!l&&!r
3170
MC/DC0%0/2
$new ||= $self->run_hook("morph_package", $step)
$new $self->run_hook("morph_package", $step)
Truth table66%2/3
A ||= B
A= $newB= $self->run_hook("morph_package", $step)
ABresult
1X1
011
000
514 0 $ref->{'info'} = "Missing morph_package for step $step";
515  
516 } elsif ($cur eq $new) {
517 2 $ref->{'info'} = "already isa $new";
518 2 $ok = 1;
519  
520 ### if we are not already that package - bless us there
521 } else {
522 18 (my $file = "$new.pm") =~ s|::|/|g;
523 18 ▶ if (UNIVERSAL::can($new, 'fixup_after_morph') # check if the package space exists
Branch: 3 branches
BranchTrueFalseTotal
if (UNIVERSAL::can($new, 'fixup_after_morph') or eval { do { require $file } } and UNIVERSAL::can($new, 'fixup_after_morph')) { } 12 6 18
elsif ($@) { } 5 1 6
elsif ($allow ne '1') { } 1 0 1
Condition66%4/6
UNIVERSAL::can($new, "fixup_after_morph") or eval { do { require $file } } and UNIVERSAL::can($new, "fixup_after_morph")
l!l&&r!l&&!r
1206
eval { do { require $file } } and UNIVERSAL::can($new, "fixup_after_morph")
!ll&&!rl&&r
510
MC/DC33%1/3
UNIVERSAL::can($new, "fixup_after_morph") or eval { do { require $file } } and UNIVERSAL::can($new, "fixup_after_morph")
UNIVERSAL::can($new, "fixup_after_morph") eval { do { require $file } } UNIVERSAL::can($new, "fixup_after_morph")
Truth table75%3/4
A or B and C
A= UNIVERSAL::can($new, "fixup_after_morph")B= eval { do { require $file } }C= UNIVERSAL::can($new, "fixup_after_morph")
ABCresult
1XX1
0111
00X0
0100
524 6 || (eval { require $file } # check for a file that holds this package
525 && UNIVERSAL::can($new, 'fixup_after_morph'))) {
526 12 bless $self, $new; # become that package
527 12 $self->fixup_after_morph($step);
528 12 $ref->{'info'} = "changed $cur to $new";
529 } elsif ($@) {
530 5 ▶ if ($allow eq '1' && $@ =~ /^\s*(Can\'t locate \S+ in \@INC)/) { # let us know what happened
Branch: 1 branch
BranchTrueFalseTotal
if ($allow eq '1' and $@ =~ /^\s*(Can\'t locate \S+ in \@INC)/) { } 4 1 5
Condition66%2/3
$allow eq 1 and $@ =~ /^\s*(Can\'t locate \S+ in \@INC)/
!ll&&!rl&&r
104
MC/DC50%1/2
$allow eq 1 and $@ =~ /^\s*(Can\'t locate \S+ in \@INC)/
$allow eq 1 $@ =~ /^\s*(Can\'t locate \S+ in \@INC)/
Truth table66%2/3
A and B
A= $allow eq 1B= $@ =~ /^\s*(Can\'t locate \S+ in \@INC)/
ABresult
0X0
100
111
531 4 $ref->{'info'} = "failed from $cur to $new: $1";
532 } else {
533 1 $ref->{'info'} = "failed from $cur to $new: $@";
534 1 die "Trouble while morphing from $cur to $new: $@";
535 }
536 } elsif ($allow ne '1') {
537 1 $ref->{'info'} = "package $new doesn't support CGI::Ex::App API";
538 1 die "Found package $new, but $new does not support CGI::Ex::App API";
539 }
540 16 $ok = 1;
541 }
542  
543 19 return $ok;
544 }
545  
546 sub replace_path {
547 31 ▶ my $self = shift;
Subroutine replace_path: called CC=3 SCAR=11.0
Pod documented
548 31 my $ref = $self->path;
549 31 ▶ my $i = $self->{'path_i'} || 0;
Condition100%2/2
$self->{'path_i'} || 0
l!l
922
MC/DC100%1/1
$self->{'path_i'} || 0
$self->{'path_i'}
Truth table100%2/2
A
A= $self->{'path_i'}
Aresult
11
00
550 31 ▶ if ($i + 1 > $#$ref) { push @$ref, @_; }
Branch: 1 branch
BranchTrueFalseTotal
if ($i + 1 > $ref->$#*) { } 13 18 31
551 18 else { splice(@$ref, $i + 1, $#$ref - $i, @_); } # replace remaining entries
552 }
553  
554 sub set_path {
555 3 ▶ my $self = shift;
Subroutine set_path: called CC=3 SCAR=11.0
Pod documented
556 3 ▶ my $path = $self->{'path'} ||= [];
Condition100%2/2
$self->{"path"} ||= []
l!l
12
MC/DC100%1/1
$self->{"path"} ||= []
$self->{"path"}
Truth table100%2/2
A
A= $self->{"path"}
Aresult
11
00
557 3 ▶ croak "Cannot call set_path after the navigation loop has begun" if $self->{'path_i'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"path_i"} 1 2 3
558 2 splice @$path, 0, $#$path + 1, @_; # change entries in the ref (which updates other copies of the ref)
559 }
560  
561 sub step_by_path_index {
562 45 ▶ my $self = shift;
Subroutine step_by_path_index: called CC=3 SCAR=11.0
Pod undocumented
563 45 ▶ my $i = shift || 0;
Condition100%2/2
shift() || 0
l!l
378
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
564 45 my $ref = $self->path;
565 43 ▶ return '' if $i < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $i < 0 1 42 43
566 42 return $ref->[$i];
567 }
568  
569 sub unmorph {
570 116 ▶ my $self = shift;
Subroutine unmorph: called CC=10 SCAR=23.4
Pod documented
571 116 ▶ my $step = shift || '_no_step';
Condition100%2/2
shift() || '_no_step'
l!l
1115
MC/DC100%1/1
shift() || '_no_step'
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
572 116 ▶ my $ref = $self->history->[-1] || {};
Condition50%1/2
$self->history->[-1] || {}
l!l
1160
MC/DC0%0/1
$self->history->[-1] || {}
$self->history->[-1]
Truth table50%1/2
A
A= $self->history->[-1]
Aresult
11
00
573 116 ▶ if (! $ref || ! $ref->{'meth'} || $ref->{'meth'} ne 'unmorph') {
Branch: 1 branch
BranchTrueFalseTotal
if (not $ref && $ref->{"meth"} or $ref->{"meth"} ne "unmorph") 114 2 116
Condition50%3/6
not $ref && $ref->{"meth"} or $ref->{"meth"} ne "unmorph"
l!l&&r!l&&!r
01142
$ref && $ref->{'meth'}
!ll&&!rl&&r
00116
MC/DC33%1/3
not $ref && $ref->{"meth"} or $ref->{"meth"} ne "unmorph"
$ref $ref->{'meth'} $ref->{"meth"} ne "unmorph"
Truth table50%2/4
not(A && B) or C
A= $refB= $ref->{'meth'}C= $ref->{"meth"} ne "unmorph"
ABCresult
0XX1
10X1
1111
1100
574 114 push @{ $self->history }, ($ref = {meth => 'unmorph', found => 'unmorph', elapsed => 0, step => $step, level => $self->{'_level'}});
575 }
576 116 ▶ my $lin = $self->{'_morph_lineage'} || return;
Condition100%2/2
$self->{'_morph_lineage'} || (return)
l!l
1997
MC/DC100%1/1
$self->{'_morph_lineage'} || (return)
$self->{'_morph_lineage'}
Truth table100%2/2
A
A= $self->{'_morph_lineage'}
Aresult
11
00
577 19 my $cur = ref $self;
578 19 ▶ my $prev = pop(@$lin) || croak "unmorph called more times than morph (current: $cur)";
Condition33%1/3
pop @$lin || croak("unmorph called more times than morph (current: $cur)")
l!l&&r!l&&!r
1900
MC/DC0%0/2
pop @$lin || croak("unmorph called more times than morph (current: $cur)")
pop @$lin croak("unmorph called more times than morph (current: $cur)")
Truth table33%1/3
A || B
A= pop @$linB= croak("unmorph called more times than morph (current: $cur)")
ABresult
1X1
011
000
579 19 ▶ delete $self->{'_morph_lineage'} if ! @$lin;
Branch: 1 branch
BranchTrueFalseTotal
unless @$lin 15 4 19
580  
581 19 ▶ if ($cur ne $prev) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cur ne $prev) { } 10 9 19
582 10 $self->fixup_before_unmorph($step);
583 10 bless $self, $prev;
584 10 $ref->{'info'} = "changed from $cur to $prev";
585 } else {
586 9 $ref->{'info'} = "already isa $cur";
587 }
588  
589 19 return 1;
590 }
591  
592 ###---------------------###
593 # hooks
594  
595 sub file_print {
596 7 ▶ my ($self, $step) = @_;
Subroutine file_print: called CC=6 SCAR=18.0
Pod documented
597 7 my $base_dir = $self->base_dir_rel;
598 7 my $module = $self->run_hook('name_module', $step);
599 7 ▶ my $_step = $self->run_hook('name_step', $step) || croak "Missing name_step";
Condition66%2/3
$self->run_hook('name_step', $step) || croak('Missing name_step')
l!l&&r!l&&!r
610
MC/DC0%0/2
$self->run_hook('name_step', $step) || croak('Missing name_step')
$self->run_hook('name_step', $step) croak('Missing name_step')
Truth table33%1/3
A || B
A= $self->run_hook('name_step', $step)B= croak('Missing name_step')
ABresult
1X1
011
000
600 6 $_step =~ s|\B__+|/|g;
601 6 ▶ $_step .= '.'. $self->ext_print if $_step !~ /\.\w+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $_step =~ /\.\w+$/ 4 2 6
602 6 ▶ foreach ($base_dir, $module) { $_ .= '/' if length($_) && ! m|/$| }
Branch: 1 branch
BranchTrueFalseTotal
if length $_ and not m[/$] 6 6 12
Condition66%2/3
length $_ and not m[/$]
!ll&&!rl&&r
606
MC/DC50%1/2
length $_ and not m[/$]
length $_ not m[/$]
Truth table66%2/3
A and not(B)
A= length $_B= not m[/$]
ABresult
0X0
100
111
603 6 return $base_dir . $module . $_step;
604 }
605  
606 sub file_val {
607 10 ▶ my ($self, $step) = @_;
Subroutine file_val: called CC=12 SCAR=24.9
Pod documented
608  
609 10 ▶ my $abs = $self->val_path || [];
Condition100%2/2
$self->val_path || []
l!l
91
MC/DC100%1/1
$self->val_path || []
$self->val_path
Truth table100%2/2
A
A= $self->val_path
Aresult
11
00
610 10 ▶ $abs = $abs->() if UNIVERSAL::isa($abs, 'CODE');
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::isa($abs, "CODE") 1 9 10
611 10 ▶ $abs = [$abs] if ! UNIVERSAL::isa($abs, 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::isa($abs, "ARRAY") 2 8 10
612 10 ▶ return {} if @$abs == 0;
Branch: 1 branch
BranchTrueFalseTotal
if @$abs == 0 1 9 10
613  
614 9 my $base_dir = $self->base_dir_rel;
615 9 my $module = $self->run_hook('name_module', $step);
616 9 ▶ my $_step = $self->run_hook('name_step', $step) || croak "Missing name_step";
Condition66%2/3
$self->run_hook('name_step', $step) || croak('Missing name_step')
l!l&&r!l&&!r
810
MC/DC0%0/2
$self->run_hook('name_step', $step) || croak('Missing name_step')
$self->run_hook('name_step', $step) croak('Missing name_step')
Truth table33%1/3
A || B
A= $self->run_hook('name_step', $step)B= croak('Missing name_step')
ABresult
1X1
011
000
617 8 $_step =~ s|\B__+|/|g;
618 8 $_step =~ s/\.\w+$//;
619 8 $_step .= '.'. $self->ext_val;
620  
621 8 ▶ foreach (@$abs, $base_dir, $module) { $_ .= '/' if length($_) && ! m|/$| }
Branch: 1 branch
BranchTrueFalseTotal
if length $_ and not m[/$] 12 13 25
Condition100%3/3
length $_ and not m[/$]
!ll&&!rl&&r
8512
MC/DC100%2/2
length $_ and not m[/$]
length $_ not m[/$]
Truth table100%3/3
A and not(B)
A= length $_B= not m[/$]
ABresult
0X0
100
111
622  
623 8 ▶ if (@$abs > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$abs > 1) 1 7 8
624 1 foreach my $_abs (@$abs) {
625 2 my $path = "$_abs/$base_dir/$module/$_step";
626 2 ▶ return $path if -e $path;
Branch: 1 branch
BranchTrueFalseTotal
if -e $path 0 2 2
627 }
628 }
629 8 return $abs->[0] . $base_dir . $module . $_step;
630 }
631  
632 sub fill_template {
633 72 ▶ my ($self, $step, $outref, $fill) = @_;
Subroutine fill_template: called CC=4 SCAR=14.0
Pod documented
634 72 ▶ return if ! $fill || ! scalar keys %$fill;
Branch: 1 branch
BranchTrueFalseTotal
unless $fill and scalar keys %$fill 1 71 72
Condition66%2/3
$fill and scalar keys %$fill
!ll&&!rl&&r
0171
MC/DC50%1/2
$fill and scalar keys %$fill
$fill scalar keys %$fill
Truth table66%2/3
A and B
A= $fillB= scalar keys %$fill
ABresult
0X0
100
111
635 71 ▶ my $args = $self->run_hook('fill_args', $step) || {};
Condition50%1/2
$self->run_hook('fill_args', $step) || {}
l!l
071
MC/DC0%0/1
$self->run_hook('fill_args', $step) || {}
$self->run_hook('fill_args', $step)
Truth table50%1/2
A
A= $self->run_hook('fill_args', $step)
Aresult
11
00
636 71 local @$args{'text', 'form'} = ($outref, $fill);
637 71 require CGI::Ex::Fill;
638 71 CGI::Ex::Fill::fill($args);
639 }
640  
641 25 ▶sub finalize { 1 } # false means show step
Subroutine finalize: called CC=1 SCAR=0.0
Pod documented
642  
643 sub hash_base {
644 78 ▶ my ($self, $step) = @_;
Subroutine hash_base: called CC=2 SCAR=7.0
Pod documented
645 78 ▶ my $hash = $self->{'hash_base'} ||= {
Condition100%2/2
$self->{"hash_base"} ||= {"script_name", $self->script_name, "path_info", $self->path_info}
l!l
771
MC/DC100%1/1
$self->{"hash_base"} ||= {"script_name", $self->script_name, "path_info", $self->path_info}
$self->{"hash_base"}
Truth table100%2/2
A
A= $self->{"hash_base"}
Aresult
11
00
646 script_name => $self->script_name,
647 path_info => $self->path_info,
648 };
649  
650 78 my $copy = $self; eval { require Scalar::Util; Scalar::Util::weaken($copy) };
651 78 ▶ $hash->{'js_validation'} = sub { $copy->run_hook('js_validation', $step, shift) };
Subroutine __ANON__: called CC=1 SCAR=0.0
652 78 ▶ $hash->{'generate_form'} = sub { $copy->run_hook('generate_form', $step, (ref($_[0]) ? (undef, shift) : shift)) };
Subroutine __ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
653 78 $hash->{'form_name'} = $self->run_hook('form_name', $step);
654 78 $hash->{$self->step_key} = $step;
655 78 return $hash;
656 }
657  
658 61 ▶sub hash_common { $_[0]->{'hash_common'} ||= {} }
Subroutine hash_common: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{"hash_common"} ||= {}
l!l
754
MC/DC100%1/1
$_[0]{"hash_common"} ||= {}
$_[0]{"hash_common"}
Truth table100%2/2
A
A= $_[0]{"hash_common"}
Aresult
11
00
659 82 ▶sub hash_errors { $_[0]->{'hash_errors'} ||= {} }
Subroutine hash_errors: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{"hash_errors"} ||= {}
l!l
1270
MC/DC100%1/1
$_[0]{"hash_errors"} ||= {}
$_[0]{"hash_errors"}
Truth table100%2/2
A
A= $_[0]{"hash_errors"}
Aresult
11
00
660 72 ▶sub hash_fill { $_[0]->{'hash_fill'} ||= {} }
Subroutine hash_fill: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{"hash_fill"} ||= {}
l!l
666
MC/DC100%1/1
$_[0]{"hash_fill"} ||= {}
$_[0]{"hash_fill"}
Truth table100%2/2
A
A= $_[0]{"hash_fill"}
Aresult
11
00
661 76 ▶sub hash_form { $_[0]->form }
Subroutine hash_form: called CC=1 SCAR=0.0
Pod documented
662 72 ▶sub hash_swap { $_[0]->{'hash_swap'} ||= {} }
Subroutine hash_swap: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{"hash_swap"} ||= {}
l!l
666
MC/DC100%1/1
$_[0]{"hash_swap"} ||= {}
$_[0]{"hash_swap"}
Truth table100%2/2
A
A= $_[0]{"hash_swap"}
Aresult
11
00
663  
664 sub hash_validation {
665 2 ▶ my ($self, $step) = @_;
Subroutine hash_validation: called CC=3 SCAR=11.3
Pod documented
666 2 ▶ return $self->{'hash_validation'}->{$step} ||= do {
Condition66%2/3
$self->{"hash_validation"}{$step} ||= do { my $file = $self->run_hook("file_val", $step); $file ? $self->val_obj->get_validation($file) : {} }
l!l&&r!l&&!r
110
MC/DC0%0/2
$self->{"hash_validation"}{$step} ||= do { my $file = $self->run_hook("file_val", $step); $file ? $self->val_obj->get_validation($file) : {} }
$self->{"hash_validation"}{$step} do { my $file = $self->run_hook("file_val", $step); $file ? $self->val_obj->get_validation($file) : {} }
Truth table66%2/3
A ||= B
A= $self->{"hash_validation"}{$step}B= do { my $file = $self->run_hook("file_val", $step); $file ? $self->val_obj->get_validation($file) : {} }
ABresult
1X1
011
000
667 1 my $file = $self->run_hook('file_val', $step);
668 1 ▶ $file ? $self->val_obj->get_validation($file) : {}; # if the file is not found, errors will be in the webserver logs (all else dies)
Branch: 1 branch
BranchTrueFalseTotal
$file ? : 1 0 1
669 };
670 }
671  
672 sub info_complete {
673 9 ▶ my ($self, $step) = @_;
Subroutine info_complete: called CC=3 SCAR=11.0
Pod documented
674 9 ▶ return 0 if ! $self->run_hook('ready_validate', $step);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->run_hook("ready_validate", $step) 1 8 9
675 8 ▶ return $self->run_hook('validate', $step, $self->form) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->run_hook('validate', $step, $self->form) ? : 4 4 8
676 }
677  
678 sub js_validation {
679 6 ▶ my ($self, $step) = @_;
Subroutine js_validation: called CC=6 SCAR=17.9
Pod documented
680 6 ▶ my $form_name = $_[2] || $self->run_hook('form_name', $step);
Condition100%3/3
$_[2] || $self->run_hook('form_name', $step)
l!l&&r!l&&!r
312
MC/DC100%2/2
$_[2] || $self->run_hook('form_name', $step)
$_[2] $self->run_hook('form_name', $step)
Truth table100%3/3
A || B
A= $_[2]B= $self->run_hook('form_name', $step)
ABresult
1X1
011
000
681 6 ▶ my $hash_val = $_[3] || $self->run_hook('hash_validation', $step);
Condition100%3/3
$_[3] || $self->run_hook('hash_validation', $step)
l!l&&r!l&&!r
213
MC/DC100%2/2
$_[3] || $self->run_hook('hash_validation', $step)
$_[3] $self->run_hook('hash_validation', $step)
Truth table100%3/3
A || B
A= $_[3]B= $self->run_hook('hash_validation', $step)
ABresult
1X1
011
000
682 6 ▶ return '' if ! $form_name || ! ref($hash_val) || ! scalar keys %$hash_val;
Branch: 1 branch
BranchTrueFalseTotal
unless $form_name and ref $hash_val and scalar keys %$hash_val 2 2 4
Condition100%6/6
$form_name and ref $hash_val and scalar keys %$hash_val
!ll&&!rl&&r
312
$form_name and ref $hash_val
!ll&&!rl&&r
213
MC/DC100%3/3
$form_name and ref $hash_val and scalar keys %$hash_val
$form_name ref $hash_val scalar keys %$hash_val
Truth table100%4/4
A and B and C
A= $form_nameB= ref $hash_valC= scalar keys %$hash_val
ABCresult
0XX0
10X0
1100
1111
683 2 return $self->val_obj->generate_js($hash_val, $form_name, $self->js_uri_path);
684 }
685  
686 sub generate_form {
687 0 ▶ my ($self, $step) = @_;
Subroutine generate_form: not called CC=6 SCAR=37.4
Pod undocumented
688 0 ▶ my $form_name = $_[2] || $self->run_hook('form_name', $step);
Condition0%0/3
$_[2] || $self->run_hook('form_name', $step)
l!l&&r!l&&!r
000
MC/DC0%0/2
$_[2] || $self->run_hook('form_name', $step)
$_[2] $self->run_hook('form_name', $step)
Truth table0%0/3
A || B
A= $_[2]B= $self->run_hook('form_name', $step)
ABresult
1X1
011
000
689 0 ▶ my $args = ref($_[3]) eq 'HASH' ? $_[3] : {};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[3] eq 'HASH' ? : 0 0 0
690 0 my $hash_val = $self->run_hook('hash_validation', $step);
691 0 ▶ return '' if ! $form_name || ! ref($hash_val) || ! scalar keys %$hash_val;
Branch: 1 branch
BranchTrueFalseTotal
unless $form_name and ref $hash_val and scalar keys %$hash_val 0 0 0
Condition0%0/6
$form_name and ref $hash_val and scalar keys %$hash_val
!ll&&!rl&&r
000
$form_name and ref $hash_val
!ll&&!rl&&r
000
MC/DC0%0/3
$form_name and ref $hash_val and scalar keys %$hash_val
$form_name ref $hash_val scalar keys %$hash_val
Truth table0%0/4
A and B and C
A= $form_nameB= ref $hash_valC= scalar keys %$hash_val
ABCresult
0XX0
10X0
1100
1111
692 0 local $args->{'js_uri_path'} = $self->js_uri_path;
693 0 return $self->val_obj->generate_form($hash_val, $form_name, $args);
694 }
695  
696 20 ▶sub morph_base { my $self = shift; ref($self) }
Subroutine morph_base: called CC=1 SCAR=0.0
Pod undocumented
697 sub morph_package {
698 20 ▶ my ($self, $step) = @_;
Subroutine morph_package: called CC=3 SCAR=11.2
Pod documented
699 20 my $cur = $self->morph_base; # default to using self as the base for morphed modules
700 20 ▶ my $new = ($cur ? $cur .'::' : '') . ($step || croak "Missing step");
Branch: 1 branch
BranchTrueFalseTotal
$cur ? : 20 0 20
Condition66%2/3
$step || croak('Missing step')
l!l&&r!l&&!r
1910
MC/DC0%0/2
$step || croak('Missing step')
$step croak('Missing step')
Truth table33%1/3
A || B
A= $stepB= croak('Missing step')
ABresult
1X1
011
000
701 19 $new =~ s/\B__+/::/g; # turn Foo::my_nested__step info Foo::my_nested::step
702 19 $new =~ s/(?:_+|\b)(\w)/\u$1/g; # turn Foo::my_step_name into Foo::MyStepName
703 19 return $new;
704 }
705  
706 sub name_module {
707 21 ▶ my ($self, $step) = @_;
Subroutine name_module: called CC=4 SCAR=13.9
Pod documented
708 21 ▶ return $self->{'name_module'} ||= ($self->script_name =~ m/ (\w+) (?:\.\w+)? $/x)
Branch: 1 branch
BranchTrueFalseTotal
$self->script_name =~ / (\w+) (?:\.\w+)? $/x ? : 16 2 18
Condition80%4/5
$self->{"name_module"} ||= $self->script_name =~ / (\w+) (?:\.\w+)? $/x ? $1 : die('Could not determine module name from "name_module" lookup (' . ($step || "") . ")\n")
l!l&&r!l&&!r
3180
$step || ''
l!l
11
MC/DC0%0/2
$self->{"name_module"} ||= $self->script_name =~ / (\w+) (?:\.\w+)? $/x ? $1 : die('Could not determine module name from "name_module" lookup (' . ($step || "") . ")\n")
$self->{"name_module"} $self->script_name =~ / (\w+) (?:\.\w+)? $/x ? $1 : die('Could not determine module name from "name_module" lookup (' . ($step || "") . ")\n")
MC/DC100%1/1
$step || ''
$step
Truth table66%2/3
A ||= B
A= $self->{"name_module"}B= $self->script_name =~ / (\w+) (?:\.\w+)? $/x ? $1 : die('Could not determine module name from "name_module" lookup (' . ($step || "") . ")\n")
ABresult
1X1
011
000
Truth table100%2/2
A
A= $step
Aresult
11
00
709 ? $1 : die "Could not determine module name from \"name_module\" lookup (".($step||'').")\n";
710 }
711  
712 10 ▶sub name_step { my ($self, $step) = @_; $step }
Subroutine name_step: called CC=1 SCAR=0.0
Pod documented
713 28 ▶sub next_step { $_[0]->step_by_path_index(($_[0]->{'path_i'} || 0) + 1) }
Subroutine next_step: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{'path_i'} || 0
l!l
244
MC/DC100%1/1
$_[0]{'path_i'} || 0
$_[0]{'path_i'}
Truth table100%2/2
A
A= $_[0]{'path_i'}
Aresult
11
00
714 72 ▶sub post_print { 0 }
Subroutine post_print: called CC=1 SCAR=0.0
Pod documented
715 27 ▶sub post_step { 0 } # true indicates we handled step (exit loop)
Subroutine post_step: called CC=1 SCAR=0.0
Pod documented
716 109 ▶sub pre_step { 0 } # true indicates we handled step (exit loop)
Subroutine pre_step: called CC=1 SCAR=0.0
Pod documented
717 100 ▶sub prepare { 1 } # false means show step
Subroutine prepare: called CC=1 SCAR=0.0
Pod documented
718  
719 sub print_out {
720 4 ▶ my ($self, $step, $out) = @_;
Subroutine print_out: called CC=2 SCAR=6.9
Pod documented
721 4 $self->cgix->print_content_type($self->run_hook('mimetype', $step), $self->run_hook('charset', $step));
722 4 ▶ print ref($out) eq 'SCALAR' ? $$out : $out;
Branch: 1 branch
BranchTrueFalseTotal
ref $out eq 'SCALAR' ? : 1 3 4
723 }
724  
725 sub ready_validate {
726 12 ▶ my ($self, $step) = @_;
Subroutine ready_validate: called CC=7 SCAR=27.8
Pod documented
727 12 ▶ if ($self->run_hook('validate_when_data', $step)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->run_hook("validate_when_data", $step) and my(@keys) = keys %{$self->run_hook("hash_validation", $step) or {};}) 0 12 12
Condition33%1/3
$self->run_hook("validate_when_data", $step) and my(@keys) = keys %{$self->run_hook("hash_validation", $step) or {};}
!ll&&!rl&&r
1200
MC/DC0%0/2
$self->run_hook("validate_when_data", $step) and my(@keys) = keys %{$self->run_hook("hash_validation", $step) or {};}
$self->run_hook("validate_when_data", $step) my(@keys) = keys %{$self->run_hook("hash_validation", $step) or {};}
Truth table33%1/3
A and B
A= $self->run_hook("validate_when_data", $step)B= my(@keys) = keys %{$self->run_hook("hash_validation", $step) or {};}
ABresult
0X0
100
111
728 0 ▶ and my @keys = keys %{ $self->run_hook('hash_validation', $step) || {} }) {
Branch: 1 branch
BranchTrueFalseTotal
$self->run_hook("hash_validation", $step) or {} 0 0 0
729 0 my $form = $self->form;
730 0 ▶ return (grep { exists $form->{$_} } @keys) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
grep({exists $form->{$_};} @keys) ? : 0 0 0
731 }
732 12 ▶ return ($ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq 'POST') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq 'POST' ? : 9 3 12
Condition66%2/3
$ENV{"REQUEST_METHOD"} and $ENV{"REQUEST_METHOD"} eq "POST"
!ll&&!rl&&r
039
MC/DC50%1/2
$ENV{"REQUEST_METHOD"} and $ENV{"REQUEST_METHOD"} eq "POST"
$ENV{"REQUEST_METHOD"} $ENV{"REQUEST_METHOD"} eq "POST"
Truth table66%2/3
A and B
A= $ENV{"REQUEST_METHOD"}B= $ENV{"REQUEST_METHOD"} eq "POST"
ABresult
0X0
100
111
733 }
734  
735 sub refine_path {
736 36 ▶ my ($self, $step, $is_at_end) = @_;
Subroutine refine_path: called CC=3 SCAR=11.0
Pod documented
737 36 ▶ return 0 if ! $is_at_end; # if we are not at the end of the path, do not do anything
Branch: 1 branch
BranchTrueFalseTotal
unless $is_at_end 9 27 36
738 27 ▶ my $next_step = $self->run_hook('next_step', $step) || return 0;
Condition100%2/2
$self->run_hook('next_step', $step) || (return 0)
l!l
126
MC/DC100%1/1
$self->run_hook('next_step', $step) || (return 0)
$self->run_hook('next_step', $step)
Truth table100%2/2
A
A= $self->run_hook('next_step', $step)
Aresult
11
00
739 1 $self->run_hook('set_ready_validate', $step, 0);
740 1 $self->append_path($next_step);
741 1 return 1;
742 }
743  
744 sub set_ready_validate {
745 5 ▶ my $self = shift;
Subroutine set_ready_validate: called CC=3 SCAR=11.0
Pod documented
746 5 ▶ my ($step, $is_ready) = (@_ == 2) ? @_ : (undef, shift); # hook and method
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 2 3 5
747 5 ▶ $ENV{'REQUEST_METHOD'} = ($is_ready) ? 'POST' : 'GET';
Branch: 1 branch
BranchTrueFalseTotal
$is_ready ? : 2 3 5
748 5 return $is_ready;
749 }
750  
751 101 ▶sub skip { 0 } # success indicates to skip the step (and continue loop)
Subroutine skip: called CC=1 SCAR=0.0
Pod documented
752  
753 sub swap_template {
754 72 ▶ my ($self, $step, $file, $swap) = @_;
Subroutine swap_template: called CC=2 SCAR=7.0
Pod documented
755 72 my $t = $self->__template_obj($step);
756 72 my $out = '';
757 72 ▶ $t->process($file, $swap, \$out) || die $t->error;
Branch: 1 branch
BranchTrueFalseTotal
$t->process($file, $swap, \$out) or die $t->error 0 72 72
758 72 return $out;
759 }
760  
761 sub __template_obj {
762 72 ▶ my ($self, $step) = @_;
Subroutine __template_obj: called CC=4 SCAR=16.4
763 72 ▶ my $args = $self->run_hook('template_args', $step) || {};
Condition50%1/2
$self->run_hook('template_args', $step) || {}
l!l
072
MC/DC0%0/1
$self->run_hook('template_args', $step) || {}
$self->run_hook('template_args', $step)
Truth table50%1/2
A
A= $self->run_hook('template_args', $step)
Aresult
11
00
764 72 ▶ $args->{'INCLUDE_PATH'} ||= $args->{'include_path'} || $self->template_path;
Condition33%2/6
$args->{"INCLUDE_PATH"} ||= $args->{"include_path"} || $self->template_path
l!l&&r!l&&!r
0720
$args->{'include_path'} || $self->template_path
l!l&&r!l&&!r
0720
MC/DC0%0/3
$args->{"INCLUDE_PATH"} ||= $args->{"include_path"} || $self->template_path
$args->{"INCLUDE_PATH"} $args->{'include_path'} $self->template_path
Truth table0%0/4
A ||= B || C
A= $args->{"INCLUDE_PATH"}B= $args->{'include_path'}C= $self->template_path
ABCresult
1XX1
01X1
0011
0000
765 72 return $self->template_obj($args);
766 }
767  
768 sub validate {
769 8 ▶ my ($self, $step, $form) = @_;
Subroutine validate: called CC=12 SCAR=28.0
Pod documented
770 8 my $hash = $self->__hash_validation($step);
771 8 ▶ return 1 if ! ref($hash) || ! scalar keys %$hash;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $hash and scalar keys %$hash 1 7 8
Condition66%2/3
ref $hash and scalar keys %$hash
!ll&&!rl&&r
107
MC/DC50%1/2
ref $hash and scalar keys %$hash
ref $hash scalar keys %$hash
Truth table66%2/3
A and B
A= ref $hashB= scalar keys %$hash
ABresult
0X0
100
111
772  
773 7 my @validated_fields;
774 7 ▶ if (my $err_obj = eval { $self->val_obj->validate($form, $hash, \@validated_fields) }) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $err_obj = eval { do { $self->val_obj->validate($form, $hash, \@validated_fields) } }) 4 3 7
775 4 $self->add_errors($err_obj->as_hash({as_hash_join => "<br>\n", as_hash_suffix => '_error'}));
776 4 return 0;
777 }
778 3 ▶ die "Step $step: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 3 3
779  
780 3 foreach my $ref (@validated_fields) { # allow for the validation to give us some redirection
781 3 ▶ $self->append_path( ref $_ ? @$_ : $_) if $_ = $ref->{'append_path'};
Branch: 2 branches
BranchTrueFalseTotal
if $_ = $ref->{"append_path"} 0 3 3
ref $_ ? : 0 0 0
782 3 ▶ $self->replace_path(ref $_ ? @$_ : $_) if $_ = $ref->{'replace_path'};
Branch: 2 branches
BranchTrueFalseTotal
if $_ = $ref->{"replace_path"} 0 3 3
ref $_ ? : 0 0 0
783 3 ▶ $self->insert_path( ref $_ ? @$_ : $_) if $_ = $ref->{'insert_path'};
Branch: 2 branches
BranchTrueFalseTotal
if $_ = $ref->{"insert_path"} 0 3 3
ref $_ ? : 0 0 0
784 }
785  
786 3 return 1;
787 }
788  
789 8 ▶sub __hash_validation { shift->run_hook('hash_validation', @_) }
Subroutine __hash_validation: called CC=1 SCAR=0.0
790  
791 12 ▶sub validate_when_data { $_[0]->{'validate_when_data'} }
Subroutine validate_when_data: called CC=1 SCAR=0.0
Pod documented
792  
793 ###---------------------###
794 # authentication
795  
796 sub navigate_authenticated {
797 3 ▶ my ($self, $args) = @_;
Subroutine navigate_authenticated: called CC=3 SCAR=11.0
Pod documented
798 3 ▶ $self = $self->new($args) if ! ref $self;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 0 3 3
799 3 ▶ croak "Cannot call navigate_authenticated method if default require_auth method is overwritten"
Branch: 1 branch
BranchTrueFalseTotal
if $self->can("require_auth") != \&CGI::Ex::App::require_auth 1 2 3
800 if $self->can('require_auth') != \&CGI::Ex::App::require_auth;
801 2 $self->require_auth(1);
802 2 return $self->navigate;
803 }
804  
805 sub require_auth {
806 116 ▶ my $self = shift;
Subroutine require_auth: called CC=6 SCAR=18.0
Pod documented
807 116 ▶ $self->{'require_auth'} = shift if @_ == 1 && (! defined($_[0]) || ref($_[0]) || $_[0] =~ /^[01]$/);
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 and !defined($_[0]) || ref $_[0] || $_[0] =~ /^[01]$/ 5 111 116
Condition77%7/9
@_ == 1 and !defined($_[0]) || ref $_[0] || $_[0] =~ /^[01]$/
!ll&&!rl&&r
11114
not defined $_[0] or ref $_[0] or $_[0] =~ /^[01]$/
l!l&&r!l&&!r
140
not defined $_[0] or ref $_[0]
l!l&&r!l&&!r
014
MC/DC25%1/4
@_ == 1 and !defined($_[0]) || ref $_[0] || $_[0] =~ /^[01]$/
@_ == 1 not defined $_[0] ref $_[0] $_[0] =~ /^[01]$/
Truth table40%2/5
A and not(B) or C or D
A= @_ == 1B= not defined $_[0]C= ref $_[0]D= $_[0] =~ /^[01]$/
ABCDresult
0XXX0
10000
11XX1
101X1
10011
808 116 ▶ return $self->{'require_auth'} || 0;
Condition100%2/2
$self->{'require_auth'} || 0
l!l
11105
MC/DC100%1/1
$self->{'require_auth'} || 0
$self->{'require_auth'}
Truth table100%2/2
A
A= $self->{'require_auth'}
Aresult
11
00
809 }
810  
811 138 ▶sub is_authed { my $data = shift->auth_data; $data && ! $data->{'error'} }
Subroutine is_authed: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$data and not $data->{"error"} 2 136 138
812  
813 4 ▶sub check_valid_auth { shift->_do_auth({login_print => sub {}, location_bounce => sub {}}) }
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine check_valid_auth: called CC=1 SCAR=0.0
Pod undocumented
814  
815 sub get_valid_auth {
816 8 ▶ my $self = shift;
Subroutine get_valid_auth: called CC=1 SCAR=0.0
Pod documented
817 return $self->_do_auth({
818 login_print => sub { # use CGI::Ex::Auth - but use our formatting and printing
819 7 ▶ my ($auth, $template, $hash) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
820 7 local $self->{'__login_file_print'} = $template;
821 7 local $self->{'__login_hash_common'} = $hash;
822 7 return $self->goto_step($self->login_step);
823 }
824 8 });
825 }
826  
827 sub _do_auth {
828 12 ▶ my ($self, $extra) = @_;
Subroutine _do_auth: called CC=16 SCAR=31.9
829 12 ▶ return $self->auth_data if $self->is_authed;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_authed 1 11 12
830 11 ▶ my $args = { %{ $self->auth_args || {} }, %{ $extra || {} } };
Branch: 2 branches
BranchTrueFalseTotal
$self->auth_args or {} 0 11 11
$extra or {} 0 11 11
831 11 ▶ $args->{'script_name'} ||= $self->script_name;
Condition33%1/3
$args->{"script_name"} ||= $self->script_name
l!l&&r!l&&!r
0110
MC/DC0%0/2
$args->{"script_name"} ||= $self->script_name
$args->{"script_name"} $self->script_name
Truth table33%1/3
A ||= B
A= $args->{"script_name"}B= $self->script_name
ABresult
1X1
011
000
832 11 ▶ $args->{'path_info'} ||= $self->path_info;
Condition33%1/3
$args->{"path_info"} ||= $self->path_info
l!l&&r!l&&!r
0011
MC/DC0%0/2
$args->{"path_info"} ||= $self->path_info
$args->{"path_info"} $self->path_info
Truth table33%1/3
A ||= B
A= $args->{"path_info"}B= $self->path_info
ABresult
1X1
011
000
833 11 ▶ $args->{'cgix'} ||= $self->cgix;
Condition33%1/3
$args->{"cgix"} ||= $self->cgix
l!l&&r!l&&!r
0110
MC/DC0%0/2
$args->{"cgix"} ||= $self->cgix
$args->{"cgix"} $self->cgix
Truth table33%1/3
A ||= B
A= $args->{"cgix"}B= $self->cgix
ABresult
1X1
011
000
834 11 ▶ $args->{'form'} ||= $self->form;
Condition33%1/3
$args->{"form"} ||= $self->form
l!l&&r!l&&!r
0110
MC/DC0%0/2
$args->{"form"} ||= $self->form
$args->{"form"} $self->form
Truth table33%1/3
A ||= B
A= $args->{"form"}B= $self->form
ABresult
1X1
011
000
835 11 ▶ $args->{'cookies'} ||= $self->cookies;
Condition33%1/3
$args->{"cookies"} ||= $self->cookies
l!l&&r!l&&!r
0110
MC/DC0%0/2
$args->{"cookies"} ||= $self->cookies
$args->{"cookies"} $self->cookies
Truth table33%1/3
A ||= B
A= $args->{"cookies"}B= $self->cookies
ABresult
1X1
011
000
836 11 ▶ $args->{'js_uri_path'} ||= $self->js_uri_path;
Condition33%1/3
$args->{"js_uri_path"} ||= $self->js_uri_path
l!l&&r!l&&!r
0110
MC/DC0%0/2
$args->{"js_uri_path"} ||= $self->js_uri_path
$args->{"js_uri_path"} $self->js_uri_path
Truth table33%1/3
A ||= B
A= $args->{"js_uri_path"}B= $self->js_uri_path
ABresult
1X1
011
000
837 11 ▶ $args->{'get_pass_by_user'} ||= sub { my ($auth, $user) = @_; $self->get_pass_by_user($user, $auth) };
Subroutine __ANON__: called CC=1 SCAR=0.4
Condition33%1/3
$args->{"get_pass_by_user"} ||= sub { my($auth, $user) = @_; $self->get_pass_by_user($user, $auth); }
l!l&&r!l&&!r
0110
MC/DC0%0/2
$args->{"get_pass_by_user"} ||= sub { my($auth, $user) = @_; $self->get_pass_by_user($user, $auth); }
$args->{"get_pass_by_user"} sub { my($auth, $user) = @_; $self->get_pass_by_user($user, $auth); }
Truth table33%1/3
A ||= B
A= $args->{"get_pass_by_user"}B= sub { my($auth, $user) = @_; $self->get_pass_by_user($user, $auth); }
ABresult
1X1
011
000
838 11 ▶ $args->{'verify_user'} ||= sub { my ($auth, $user) = @_; $self->verify_user( $user, $auth) };
Subroutine __ANON__: called CC=1 SCAR=0.4
Condition33%1/3
$args->{"verify_user"} ||= sub { my($auth, $user) = @_; $self->verify_user($user, $auth); }
l!l&&r!l&&!r
0110
MC/DC0%0/2
$args->{"verify_user"} ||= sub { my($auth, $user) = @_; $self->verify_user($user, $auth); }
$args->{"verify_user"} sub { my($auth, $user) = @_; $self->verify_user($user, $auth); }
Truth table33%1/3
A ||= B
A= $args->{"verify_user"}B= sub { my($auth, $user) = @_; $self->verify_user($user, $auth); }
ABresult
1X1
011
000
839 11 ▶ $args->{'cleanup_user'} ||= sub { my ($auth, $user) = @_; $self->cleanup_user( $user, $auth) };
Subroutine __ANON__: called CC=1 SCAR=0.4
Condition33%1/3
$args->{"cleanup_user"} ||= sub { my($auth, $user) = @_; $self->cleanup_user($user, $auth); }
l!l&&r!l&&!r
0110
MC/DC0%0/2
$args->{"cleanup_user"} ||= sub { my($auth, $user) = @_; $self->cleanup_user($user, $auth); }
$args->{"cleanup_user"} sub { my($auth, $user) = @_; $self->cleanup_user($user, $auth); }
Truth table33%1/3
A ||= B
A= $args->{"cleanup_user"}B= sub { my($auth, $user) = @_; $self->cleanup_user($user, $auth); }
ABresult
1X1
011
000
840  
841 11 my $obj = $self->auth_obj($args);
842 11 my $resp = $obj->get_valid_auth;
843 4 my $data = $obj->last_auth_data;
844 4 ▶ delete $data->{'real_pass'} if defined $data; # data may be defined but false
Branch: 1 branch
BranchTrueFalseTotal
if defined $data 3 1 4
845 4 $self->auth_data($data); # failed authentication may still have auth_data
846 4 ▶ return ($resp && $data) ? $data : undef;
Branch: 1 branch
BranchTrueFalseTotal
$resp && $data ? : 3 1 4
Condition66%2/3
$resp and $data
!ll&&!rl&&r
103
MC/DC50%1/2
$resp and $data
$resp $data
Truth table66%2/3
A and B
A= $respB= $data
ABresult
0X0
100
111
847 }
848  
849 ###---------------------###
850 # default steps
851  
852 1 ▶sub js_require_auth { 0 }
Subroutine js_require_auth: called CC=1 SCAR=0.0
Pod undocumented
853 sub js_run_step { # step that allows for printing javascript libraries that are stored in perls @INC.
854 3 ▶ my $self = shift;
Subroutine js_run_step: called CC=3 SCAR=11.0
Pod undocumented
855 3 ▶ my $path = $self->form->{'js'} || $self->path_info;
Condition100%3/3
$self->form->{'js'} || $self->path_info
l!l&&r!l&&!r
111
MC/DC100%2/2
$self->form->{'js'} || $self->path_info
$self->form->{'js'} $self->path_info
Truth table100%3/3
A || B
A= $self->form->{'js'}B= $self->path_info
ABresult
1X1
011
000
856 3 ▶ $self->cgix->print_js($path =~ m!^(?:/js/|/)?(\w+(?:/\w+)*\.js)$! ? $1 : '');
Branch: 1 branch
BranchTrueFalseTotal
$path =~ m[^(?:/js/|/)?(\w+(?:/\w+)*\.js)$] ? : 2 1 3
857 3 $self->{'_no_post_navigate'} = 1;
858 3 return 1;
859 }
860  
861 3 ▶sub __forbidden_require_auth { 0 }
Subroutine __forbidden_require_auth: called CC=1 SCAR=0.0
862 3 ▶sub __forbidden_allow_morph { shift->allow_morph(@_) && 1 }
Subroutine __forbidden_allow_morph: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
(shift())->allow_morph(@_) and 1 0 3 3
863 3 ▶sub __forbidden_info_complete { 0 } # step that will be used the path method determines it is forbidden
Subroutine __forbidden_info_complete: called CC=1 SCAR=0.0
864 3 ▶sub __forbidden_hash_common { shift->stash }
Subroutine __forbidden_hash_common: called CC=1 SCAR=0.0
865 3 ▶sub __forbidden_file_print { \ "<h1>Denied</h1>You do not have access to the step <b>\"[% forbidden_step.html %]\"</b>" }
Subroutine __forbidden_file_print: called CC=1 SCAR=0.0
866  
867 4 ▶sub __error_allow_morph { shift->allow_morph(@_) && 1 }
Subroutine __error_allow_morph: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
(shift())->allow_morph(@_) and 1 0 4 4
868 6 ▶sub __error_info_complete { 0 } # step that is used by the default handle_error
Subroutine __error_info_complete: called CC=1 SCAR=0.0
869 6 ▶sub __error_hash_common { shift->stash }
Subroutine __error_hash_common: called CC=1 SCAR=0.0
870 4 ▶sub __error_file_print { \ "<h1>A fatal error occurred</h1>Step: <b>\"[% error_step.html %]\"</b><br>[% TRY; CONFIG DUMP => {header => 0}; DUMP error; END %]" }
Subroutine __error_file_print: called CC=1 SCAR=0.0
871  
872 7 ▶sub __login_require_auth { 0 }
Subroutine __login_require_auth: called CC=1 SCAR=0.0
873 7 ▶sub __login_allow_morph { shift->allow_morph(@_) && 1 }
Subroutine __login_allow_morph: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
(shift())->allow_morph(@_) and 1 0 7 7
874 7 ▶sub __login_info_complete { 0 } # step used by default authentication
Subroutine __login_info_complete: called CC=1 SCAR=0.0
875 7 ▶sub __login_hash_common { shift->{'__login_hash_common'} || {error => "hash_common not set during default __login"} }
Subroutine __login_hash_common: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->{"__login_hash_common"} or {"error", "hash_common not set during default __login"} 0 7 7
876 7 ▶sub __login_file_print { shift->{'__login_file_print'} || \ "file_print not set during default __login<br>[% login_error %]" }
Subroutine __login_file_print: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->{"__login_file_print"} or \"file_print not set during default __login<br>[% login_error %]" 0 7 7
877  
878 2 1; # Full documentation resides in CGI/Ex/App.pod
« Ex/JSONDump.pm ↑ Summary Ex/App/Constants.pm »