| 1 | package WWW::MLite::Transaction; # $Id: Transaction.pm 15 2014-06-04 06:24:25Z minus $ | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | =head1 NAME | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | WWW::MLite::Transaction - MVC SKEL transaction | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | =head1 VERSION | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | Version 1.01 | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | my $q = new CGI; | ||||||||||||||||||||||||||||
| 15 | my ($actObject,$actEvent) = split /[,]/, $q->param('action') || ''; | ||||||||||||||||||||||||||||
| 16 | $actObject = 'default' unless $actObject && $mlite->ActionCheck($actObject); | ||||||||||||||||||||||||||||
| 17 | $actEvent = $actEvent && $actEvent =~ /go/ ? 'go' : ''; | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | my $status = $mlite->ActionTransaction($actObject,$actEvent); | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | my $status = $mlite->ActionExecute($actObject,'cdeny'); | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | Working with MVC SKEL transactions. This module based on L<MPMinus::Transaction> module. | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | See MVC SKEL transaction C<DESCRIPTION> file or L<MPMinus::Manual> | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =head1 METHODS | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | =over 8 | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =item B<ActionTransaction> | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | my $status = $mlite->ActionTransaction( $actObject, $actEvent ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | Start MVC SKEL Transaction by $actObject and $actEvent | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =item B<ActionExecute> | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | my $status = $mlite->ActionExecute( $actObject, $handler_name ); | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | Execute $handler_name action by $actObject. | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | $handler_name must be: mproc, vform, cchck, caccess, cdeny | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =item B<ActionCheck> | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | my $status = $mlite->ActionCheck( $actObject ); | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | Check existing status of $actObject handler | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =item B<getActionRecord> | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | my $struct = $mlite->getActionRecord( $actObject ); | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | Returns meta record of $actObject | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =back | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | L<MPMinus::Transaction> | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | Serz Minus (Lepenkov Sergey) L<http://www.serzik.com> E<lt>minus@mail333.comE<gt> | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | Copyright (C) 1998-2014 D&D Corporation. All Rights Reserved | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | This program is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 76 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 77 | the Free Software Foundation, either version 3 of the License, or | ||||||||||||||||||||||||||||
| 78 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||
| 81 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||
| 82 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||
| 83 | GNU General Public License for more details. | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | See C<LICENSE> file | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =cut | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 90 | 1 | $VERSION = '1.01'; | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 1 | ▶ | use CTK::Util qw/ :API /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | use constant { | ||||||||||||||||||||||||||||
| 95 | 1 | OK => 0, # See Apache2::Const::OK | |||||||||||||||||||||||||||
| 96 | HOOKS => { # Returned values of hooks / Types of hooks | ||||||||||||||||||||||||||||
| 97 | caccess => { | ||||||||||||||||||||||||||||
| 98 | aliases => [qw/caccess access/], | ||||||||||||||||||||||||||||
| 99 | type => 'DUAL', # BOOL and HTTP way | ||||||||||||||||||||||||||||
| 100 | }, | ||||||||||||||||||||||||||||
| 101 | cdeny => { | ||||||||||||||||||||||||||||
| 102 | aliases => [qw/cdeny deny/], | ||||||||||||||||||||||||||||
| 103 | type => 'HTTP', # Analyzing common constants and HTTP 1.1 status codes | ||||||||||||||||||||||||||||
| 104 | }, | ||||||||||||||||||||||||||||
| 105 | cchck => { | ||||||||||||||||||||||||||||
| 106 | aliases => [qw/cchck chck check/], | ||||||||||||||||||||||||||||
| 107 | type => 'BOOL', # 0 - false / !0 - true | ||||||||||||||||||||||||||||
| 108 | }, | ||||||||||||||||||||||||||||
| 109 | mproc => { | ||||||||||||||||||||||||||||
| 110 | aliases => [qw/mproc proc proccess/], | ||||||||||||||||||||||||||||
| 111 | type => 'HTTP', # Analyzing common constants and HTTP 1.1 status codes | ||||||||||||||||||||||||||||
| 112 | }, | ||||||||||||||||||||||||||||
| 113 | vform => { | ||||||||||||||||||||||||||||
| 114 | aliases => [qw/vform form/], | ||||||||||||||||||||||||||||
| 115 | type => 'HTTP', # Analyzing common constants and HTTP 1.1 status codes | ||||||||||||||||||||||||||||
| 116 | }, | ||||||||||||||||||||||||||||
| 117 | }, | ||||||||||||||||||||||||||||
| 118 | 1 | ▶ | }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | sub ActionTransaction { | ||||||||||||||||||||||||||||
| 121 | # Îñíîâíàÿ òðàíçàêöèÿ (âîçâðàùàåò êîä âîçâðàòà) | ||||||||||||||||||||||||||||
| 122 | 0 | ▶ | my $m = shift || ''; | ||||||||||||||||||||||||||
|
Subroutine
ActionTransaction: not called CC=10 SCAR=47.0
Pod
documented
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 123 | 0 | ▶ | my $key = shift || return 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return 0)
MC/DC0%0/1
shift() || (return 0)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 124 | 0 | ▶ | my $event = shift || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | croak("The method call is made ActionTransaction not in the style of OOP") unless ref($m) =~ /WWW\:\:MLite/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | my $sts = 0; | |||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | # Âûïîëíåíèå ïðîöåäóðû äîñòóïà (false - deny; true - allow) | ||||||||||||||||||||||||||||
| 130 | 0 | $sts = ActionExecute($m,$key,'caccess'); | |||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | # Ïðîâåðêà íà äîñòóï | ||||||||||||||||||||||||||||
| 133 | 0 | ▶ | unless ($sts) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | # Ïðîâåðêà íå ïðîøëà - çàïóñê îáðàáîò÷èêà cdeny | ||||||||||||||||||||||||||||
| 135 | 0 | $sts = ActionExecute($m,$key,'cdeny'); | |||||||||||||||||||||||||||
| 136 | 0 | return $sts; | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | 0 | ▶ | return $sts if $sts >= 300; # Âîçâðàò åñëè êîä 300 è áîëåå (àíàëèçèðóåòñÿ ðåçóëüòàò caccess) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | # Çàïóñê ïðîöåññà åñëè åñòü ñîáûòèå è óäà÷íî âûïîëíèëàñü ïðîâåðêà (âàëèäàöèÿ) ïàðàìåòðîâ | ||||||||||||||||||||||||||||
| 141 | 0 | ▶ | $sts = ActionExecute($m,$key,'mproc') if (($event =~ /go/i) && ActionExecute($m,$key,'cchck')); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$event =~ /go/i and ActionExecute($m, $key, "cchck")
MC/DC0%0/2
$event =~ /go/i and ActionExecute($m, $key, "cchck")
$event =~ /go/i
ActionExecute($m, $key, "cchck")
Truth table0%0/3
A and B
A= $event =~ /go/iB= ActionExecute($m, $key, "cchck")
| |||||||||||||||||||||||||||||
| 142 | 0 | ▶ | return $sts if $sts >= 300; # Âîçâðàò åñëè êîä 300 è áîëåå | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | # Ïîêàçûâàåì ôîðìó | ||||||||||||||||||||||||||||
| 145 | 0 | $sts = ActionExecute($m,$key,'vform'); | |||||||||||||||||||||||||||
| 146 | 0 | return $sts; | |||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||
| 148 | sub ActionExecute { | ||||||||||||||||||||||||||||
| 149 | # Âûïîëíèòü îäèí èëè íåñêîëüêî ïðîöåäóð îáðàáîò÷èêîâ äî ïåðâîãî 0-ãî (false) êîäà âîçâðàòà | ||||||||||||||||||||||||||||
| 150 | 0 | ▶ | my $m = shift || ''; | ||||||||||||||||||||||||||
|
Subroutine
ActionExecute: not called CC=20 SCAR=60.4
Pod
documented
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my $key = shift || return 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return 0)
MC/DC0%0/1
shift() || (return 0)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 152 | 0 | ▶ | my $hook = shift || return 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return 0)
MC/DC0%0/1
shift() || (return 0)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 153 | 0 | my @params = @_; | |||||||||||||||||||||||||||
| 154 | 0 | ▶ | croak("The method call is made ActionExecute not in the style of OOP") unless ref($m) =~ /WWW\:\:MLite/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | ▶ | return 0 unless ActionCheck($m,$key); # Åñëè êëþ÷à íåò -- âûõîä | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 0 | my %hooks = %{(HOOKS)}; | |||||||||||||||||||||||||||
| 158 | 0 | ▶ | return 0 unless grep {$_ eq $hook} keys %hooks; # Âîçâðàò 0 åñëè íåîïðåäåëåí êîíòåêñò òîãî ÷òî âîçâðàùàòü (default) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | # ïðèíèìàåì õåíäëåð îáðàáîò÷èêà .mpm | ||||||||||||||||||||||||||||
| 161 | #my $grec = $m->drec; | ||||||||||||||||||||||||||||
| 162 | #my $rec = $grec->{actions}{$key}{handler}; | ||||||||||||||||||||||||||||
| 163 | 0 | my $rec = $m->get_rec($key); | |||||||||||||||||||||||||||
| 164 | 0 | my $phase = _getPhaseByAlias($rec->{handler},$hook); | |||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | #$m->debug("> Running $hook"); | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | #no strict 'refs'; # Äîáàâëåíî äëÿ âîçìîæíîñòè äîñòóïà ê ññûëêàì êàê ïðîöåäóðàì | ||||||||||||||||||||||||||||
| 169 | 0 | ▶ | if (ref($phase) eq 'CODE') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 170 | # Âûïîëíÿåì êîä | ||||||||||||||||||||||||||||
| 171 | #$m->debug("> -- $hook -> CODE"); | ||||||||||||||||||||||||||||
| 172 | 0 | return $phase->($m,@params) | |||||||||||||||||||||||||||
| 173 | } elsif (ref($phase) eq 'ARRAY') { | ||||||||||||||||||||||||||||
| 174 | # Âûïîëíÿåì êàñêàä êîäîâ äî ïåðâîé íåóäà÷è | ||||||||||||||||||||||||||||
| 175 | 0 | my $status; | |||||||||||||||||||||||||||
| 176 | 0 | foreach (@$phase) { | |||||||||||||||||||||||||||
| 177 | # $m->debug($_->($m,@params)); | ||||||||||||||||||||||||||||
| 178 | 0 | ▶ | $status = (ref($_) eq 'CODE') ? $_->($m,@params) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 179 | #$m->debug("> $hook -> CODE[$status]"); | ||||||||||||||||||||||||||||
| 180 | 0 | my $typ = $hooks{$hook}{type}; | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | ▶ | if ($typ eq 'BOOL') { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 183 | 0 | ▶ | last unless $status; # Âûõîä åñëè õîòÿáû êòî-òî âåðíóë çíà÷åíèå false | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | } elsif ($typ eq 'HTTP') { | ||||||||||||||||||||||||||||
| 185 | # Âûõîä åñëè îòâåò >=300 (REDIRECTIONS AND ERRORS) | ||||||||||||||||||||||||||||
| 186 | 0 | ▶ | last unless (($status =~ /^[+\-]?\d+$/) && $status < 300); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$status =~ /^[+\-]?\d+$/ and $status < 300
MC/DC0%0/2
$status =~ /^[+\-]?\d+$/ and $status < 300
$status =~ /^[+\-]?\d+$/
$status < 300
Truth table0%0/3
A and B
A= $status =~ /^[+\-]?\d+$/B= $status < 300
| |||||||||||||||||||||||||||||
| 187 | } elsif ($typ eq 'DUAL') { | ||||||||||||||||||||||||||||
| 188 | 0 | ▶ | last unless $status; # Âûõîä åñëè õîòÿáû êòî-òî âåðíóë çíà÷åíèå false | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | # Âûõîä åñëè îòâåò 0 (OK) èëè >=300 (REDIRECTIONS AND ERRORS) | ||||||||||||||||||||||||||||
| 190 | 0 | ▶ | last unless (($status =~ /^[+\-]?\d+$/) && $status < 300); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$status =~ /^[+\-]?\d+$/ and $status < 300
MC/DC0%0/2
$status =~ /^[+\-]?\d+$/ and $status < 300
$status =~ /^[+\-]?\d+$/
$status < 300
Truth table0%0/3
A and B
A= $status =~ /^[+\-]?\d+$/B= $status < 300
| |||||||||||||||||||||||||||||
| 191 | } else { # VOID and etc. | ||||||||||||||||||||||||||||
| 192 | 0 | $status = OK; | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | 0 | return $status; | |||||||||||||||||||||||||||
| 196 | } else { | ||||||||||||||||||||||||||||
| 197 | #$m->debug("> -- $hook -> VOID"); | ||||||||||||||||||||||||||||
| 198 | 0 | return 0; | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | 0 | return 0; | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | sub ActionCheck { | ||||||||||||||||||||||||||||
| 203 | 0 | ▶ | my $m = shift || ''; | ||||||||||||||||||||||||||
|
Subroutine
ActionCheck: not called CC=5 SCAR=34.0
Pod
documented
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 204 | 0 | ▶ | my $key = shift || return 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return 0)
MC/DC0%0/1
shift() || (return 0)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 205 | 0 | ▶ | croak("The method call is made ActionCheck not in the style of OOP") unless ref($m) =~ /WWW\:\:MLite/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 0 | my $rec = $m->get_rec($key); | |||||||||||||||||||||||||||
| 207 | 0 | ▶ | return $rec->{handler} ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | sub getActionRecord { | ||||||||||||||||||||||||||||
| 210 | # Ïðî÷èòàòü ìåòàîïðåäåëåíèÿ ïî êëþ÷ó èëè âñå | ||||||||||||||||||||||||||||
| 211 | 0 | ▶ | my $m = shift || ''; | ||||||||||||||||||||||||||
|
Subroutine
getActionRecord: not called CC=4 SCAR=30.0
Pod
documented
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 212 | 0 | my $key = shift; | |||||||||||||||||||||||||||
| 213 | 0 | ▶ | croak("The method call is made getActionRecord not in the style of OOP") unless ref($m) =~ /WWW\:\:MLite/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | ▶ | return $m->get_rec($key) if $key; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | 0 | return $m->get_recs; | |||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | sub _getPhaseByAlias { | ||||||||||||||||||||||||||||
| 219 | 0 | ▶ | my $rec = shift || {}; | ||||||||||||||||||||||||||
|
Subroutine
_getPhaseByAlias: not called CC=6 SCAR=37.4
Condition0%0/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 220 | 0 | ▶ | my $hook = shift || '_'; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || '_'
MC/DC0%0/1
shift() || '_'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 221 | 0 | my %hooks = %{(HOOKS)}; | |||||||||||||||||||||||||||
| 222 | 0 | my $aliases = $hooks{$hook}{aliases}; | |||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | 0 | my $ret; | |||||||||||||||||||||||||||
| 225 | 0 | foreach (@$aliases) { | |||||||||||||||||||||||||||
| 226 | 0 | ▶ | if ($rec->{$_} && ref($rec->{$_})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rec->{$_} and ref $rec->{$_}
MC/DC0%0/2
$rec->{$_} and ref $rec->{$_}
$rec->{$_}
ref $rec->{$_}
Truth table0%0/3
A and B
A= $rec->{$_}B= ref $rec->{$_}
| |||||||||||||||||||||||||||||
| 227 | 0 | $ret = $rec->{$_}; | |||||||||||||||||||||||||||
| 228 | 0 | last; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 0 | return $ret; | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | 1 | 1; | |||||||||||||||||||||||||||