| 1 | |||||||||||||||||||||||||||||
| 2 | package | ||||||||||||||||||||||||||||
| 3 | ASP4::HTTPHandler; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 15 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 15 | ▶ | use warnings 'all'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 15 | ▶ | use Data::Properties::YAML; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | BEGIN { | ||||||||||||||||||||||||||||
| 10 | 3102 | ▶ | sub VARS { | ||||||||||||||||||||||||||
|
Subroutine
VARS: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 3102 | qw( | |||||||||||||||||||||||||||
| 12 | $Request $Response | ||||||||||||||||||||||||||||
| 13 | $Session $Server | ||||||||||||||||||||||||||||
| 14 | $Config $Form | ||||||||||||||||||||||||||||
| 15 | $Stash | ||||||||||||||||||||||||||||
| 16 | ) | ||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | 15 | ▶ | use vars __PACKAGE__->VARS; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 2015 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 23 | 2015 | my ($class, %args) = @_; | |||||||||||||||||||||||||||
| 24 | 2015 | return bless \%args, $class; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 5145 | ▶ | sub before_run { 1; } | ||||||||||||||||||||||||||
|
Subroutine
before_run: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 5145 | ▶ | sub after_run { } | ||||||||||||||||||||||||||
|
Subroutine
after_run: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub request { $Request } | ||||||||||||||||||||||||||
|
Subroutine
request: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub response { $Response } | ||||||||||||||||||||||||||
|
Subroutine
response: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub session { $Session } | ||||||||||||||||||||||||||
|
Subroutine
session: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub stash { $Stash } | ||||||||||||||||||||||||||
|
Subroutine
stash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub server { $Server } | ||||||||||||||||||||||||||
|
Subroutine
server: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub form { $Form } | ||||||||||||||||||||||||||
|
Subroutine
form: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub config { $Config } | ||||||||||||||||||||||||||
|
Subroutine
config: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | sub init_asp_objects | ||||||||||||||||||||||||||||
| 40 | 5147 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
init_asp_objects: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 41 | 5147 | my ($s, $context) = @_; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 5147 | $Request = $context->request; | |||||||||||||||||||||||||||
| 44 | 5147 | $Response = $context->response; | |||||||||||||||||||||||||||
| 45 | 5147 | $Session = $context->session; | |||||||||||||||||||||||||||
| 46 | 5147 | $Server = $context->server; | |||||||||||||||||||||||||||
| 47 | 5147 | $Form = $context->request->Form; | |||||||||||||||||||||||||||
| 48 | 5147 | $Config = $context->config; | |||||||||||||||||||||||||||
| 49 | 5147 | $Stash = $context->stash; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 5147 | ▶ | my $class = ref($s) ? ref($s) : $s; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 5147 | my @classes = $s->_parents( $class ); | |||||||||||||||||||||||||||
| 53 | 15 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 54 | 5147 | my %saw = ( ); | |||||||||||||||||||||||||||
| 55 | map { | ||||||||||||||||||||||||||||
| 56 | 20448 | ${"$_\::Request"} = $Request; | |||||||||||||||||||||||||||
| 57 | 20448 | ${"$_\::Response"} = $Response; | |||||||||||||||||||||||||||
| 58 | 20448 | ${"$_\::Session"} = $Session; | |||||||||||||||||||||||||||
| 59 | 20448 | ${"$_\::Server"} = $Server; | |||||||||||||||||||||||||||
| 60 | 20448 | ${"$_\::Form"} = $Form; | |||||||||||||||||||||||||||
| 61 | 20448 | ${"$_\::Config"} = $Config; | |||||||||||||||||||||||||||
| 62 | 20448 | ${"$_\::Stash"} = $Stash; | |||||||||||||||||||||||||||
| 63 | 5147 | } grep { ! $saw{$_}++ } @classes; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 5147 | return 1; | |||||||||||||||||||||||||||
| 66 | }# end init_asp_objects() | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | sub properties | ||||||||||||||||||||||||||||
| 70 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
properties: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 71 | 0 | my ($s, $file) = @_; | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | ▶ | $file ||= $Config->web->application_root . '/etc/properties.yaml'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$file ||= $ASP4::HTTPHandler::Config->web->application_root . '/etc/properties.yaml'
MC/DC0%0/1
$file ||= $ASP4::HTTPHandler::Config->web->application_root . '/etc/properties.yaml'
$file
Truth table0%0/2
A
A= $file
| |||||||||||||||||||||||||||||
| 74 | 0 | return Data::Properties::YAML->new( properties_file => $file ); | |||||||||||||||||||||||||||
| 75 | }# end properties() | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | sub trim_form | ||||||||||||||||||||||||||||
| 78 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
trim_form: not called CC=1 SCAR=1.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 79 | 15 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | map { | ||||||||||||||||||||||||||||
| 82 | 0 | $Form->{$_} =~ s/^\s+//; | |||||||||||||||||||||||||||
| 83 | 0 | $Form->{$_} =~ s/\s+$//; | |||||||||||||||||||||||||||
| 84 | } keys %$Form; | ||||||||||||||||||||||||||||
| 85 | }# end trim_form() | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | sub _parents | ||||||||||||||||||||||||||||
| 89 | 5220 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_parents: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 90 | 5220 | my ($s, $class ) = @_; | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 15 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 5220 | ▶ | ${"$class\::__PARENTS_TIME"} ||= 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
${"${class}::__PARENTS_TIME";} ||= 0
MC/DC100%1/1
${"${class}::__PARENTS_TIME";} ||= 0
${"${class}::__PARENTS_TIME";}
Truth table100%2/2
A
A= ${"${class}::__PARENTS_TIME";}
| |||||||||||||||||||||||||||||
| 95 | 5220 | my $diff = time() - ${"$class\::__PARENTS_TIME"}; | |||||||||||||||||||||||||||
| 96 | 5220 | my $max_age = 5; | |||||||||||||||||||||||||||
| 97 | 5220 | ▶ | if( @{"$class\::__PARENTS"} && $diff < $max_age ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@{"${class}::__PARENTS";} and $diff < $max_age
MC/DC100%2/2
@{"${class}::__PARENTS";} and $diff < $max_age
@{"${class}::__PARENTS";}
$diff < $max_age
Truth table100%3/3
A and B
A= @{"${class}::__PARENTS";}B= $diff < $max_age
| |||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||
| 99 | 5133 | return @{"$class\::__PARENTS"}; | |||||||||||||||||||||||||||
| 100 | }# end if() | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 87 | my @classes = ( $class ); | |||||||||||||||||||||||||||
| 103 | 87 | my $pkg = __PACKAGE__; | |||||||||||||||||||||||||||
| 104 | 87 | my %saw = ( ); | |||||||||||||||||||||||||||
| 105 | 73 | push @classes, map { $s->_parents( $_ ) } | |||||||||||||||||||||||||||
| 106 | 73 | ▶ | grep { ( ! $saw{$_}++ ) && $_->isa($pkg) } | ||||||||||||||||||||||||||
|
Condition33%1/3
!$saw{$_}++ && $_->isa($pkg)
MC/DC0%0/2
!$saw{$_}++ && $_->isa($pkg)
!$saw{$_}++
$_->isa($pkg)
Truth table33%1/3
not(A) && B
A= !$saw{$_}++B= $_->isa($pkg)
| |||||||||||||||||||||||||||||
| 107 | 87 | @{"$class\::ISA"}; | |||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 87 | ${"$class\::__PARENTS_TIME"} = time(); | |||||||||||||||||||||||||||
| 110 | 87 | return @{"$class\::__PARENTS"} = @classes; | |||||||||||||||||||||||||||
| 111 | }# end _parents() | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | sub DESTROY | ||||||||||||||||||||||||||||
| 115 | 8209 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 116 | 8209 | my $s = shift; | |||||||||||||||||||||||||||
| 117 | 8209 | undef(%$s); | |||||||||||||||||||||||||||
| 118 | }# end DESTROY() | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 15 | 1;# return true: | |||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||