| 1 | |||||||||||||||||||||||||||||||||||||||||||
| 2 | package Apache2::ASP::HTTPContext::SubContext; | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 23 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 23 | ▶ | use warnings 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 23 | ▶ | use base 'Apache2::ASP::HTTPContext'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||
| 10 | sub new | ||||||||||||||||||||||||||||||||||||||||||
| 11 | { | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | die "Required param 'parent' was not provided" | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | unless $args{parent}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | die "Param 'parent' isn't a Apache2::ASP::HTTPContext" | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | unless $args{parent}->isa( 'Apache2::ASP::HTTPContext' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | $class = ref($class) || $class; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my $s = bless \%args, $class; | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | $Apache2::ASP::HTTPContext::instance = $s; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | return $s; | |||||||||||||||||||||||||||||||||||||||||
| 24 | }# end new() | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||
| 28 | sub setup_request | ||||||||||||||||||||||||||||||||||||||||||
| 29 | { | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | my ($s, $requestrec, $cgi) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setup_request: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $s->{r} = $requestrec; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | $s->{cgi} = $cgi; | |||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | $s->{connection} = $s->r->connection; | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my $resolver = $s->config->web->handler_resolver; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $s->_load_class( $resolver ); | |||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | $s->{handler} = $resolver->new()->resolve_request_handler( $s->r->uri ); | |||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 42 | }# end setup_request() | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||
| 46 | sub execute | ||||||||||||||||||||||||||||||||||||||||||
| 47 | { | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my ($s, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | # local $SIG{__DIE__} = \&Carp::confess; | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $s->_load_class( $s->config->web->handler_runner ); | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $s->_load_class( $s->handler ); | |||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | $s->config->web->handler_runner->new()->run_handler( $s->handler, $args ); | |||||||||||||||||||||||||||||||||||||||||
| 55 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if( $@ ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | $s->server->{LastError} = $@; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | return $s->handle_error; | |||||||||||||||||||||||||||||||||||||||||
| 60 | }# end if() | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $s->response->Flush; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | my $res = $s->{parent} ? $s->response->Status : $s->end_request(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | if( $s->page && $s->page->directives->{OutputCache} && defined($s->{_cache_buffer}) ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$s->page and $s->page->directives->{"OutputCache"} and defined $s->{"_cache_buffer"}
$s->page and $s->page->directives->{"OutputCache"}
MC/DC0%0/3
$s->page and $s->page->directives->{"OutputCache"} and defined $s->{"_cache_buffer"}
$s->page
$s->page->directives->{"OutputCache"}
defined $s->{"_cache_buffer"}
Truth table0%0/4
A and B and C
A= $s->pageB= $s->page->directives->{"OutputCache"}C= defined $s->{"_cache_buffer"}
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | { | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | if( $res == 200 || $res == 0 ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$res == 200 or $res == 0
MC/DC0%0/2
$res == 200 or $res == 0
$res == 200
$res == 0
Truth table0%0/3
A or B
A= $res == 200B= $res == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | { | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $s->page->_write_cache( \$s->{_cache_buffer} ); | |||||||||||||||||||||||||||||||||||||||||
| 69 | }# end if() | ||||||||||||||||||||||||||||||||||||||||||
| 70 | }# end if() | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | $res = 0 if $res =~ m/^200/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | return $res; | |||||||||||||||||||||||||||||||||||||||||
| 74 | }# end execute() | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||
| 78 | sub get_prop | ||||||||||||||||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | my ($s, $prop) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_prop: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | $s->{parent}->get_prop($prop); | |||||||||||||||||||||||||||||||||||||||||
| 83 | }# end get_prop() | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||
| 87 | sub set_prop | ||||||||||||||||||||||||||||||||||||||||||
| 88 | { | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | my ($s) = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_prop: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my $prop = shift; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $s->{parent}->set_prop($prop, @_); | |||||||||||||||||||||||||||||||||||||||||
| 93 | }# end set_prop() | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | sub config { shift->get_prop('config') } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
config: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub session { shift->get_prop('session') } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
session: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | sub server { shift->get_prop('server') } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
server: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | sub request { shift->get_prop('request') } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | sub response { shift->get_prop('response') } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
response: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | sub application { shift->get_prop('application') } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
application: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | sub stash { shift->get_prop('stash') } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | sub global_asa { shift->get_prop('global_asa') } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
global_asa: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub _is_setup { shift->get_prop('_is_setup') } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_setup: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||
| 107 | sub rflush | ||||||||||||||||||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | my $s = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rflush: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $s->{r}->rflush(); | |||||||||||||||||||||||||||||||||||||||||
| 112 | }# end rflush() | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||
| 116 | sub DESTROY | ||||||||||||||||||||||||||||||||||||||||||
| 117 | { | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | my $s = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if( my $parent = $s->{parent} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | { | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $Apache2::ASP::HTTPContext::instance = $parent; | |||||||||||||||||||||||||||||||||||||||||
| 123 | }# end if() | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | undef(%$s); | |||||||||||||||||||||||||||||||||||||||||
| 126 | }# end DESTROY() | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 23 | 1;# return true: | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||