| 1 | package Drogo::Guts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use constant OK => 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use constant DECLINED => -5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use constant HTTP_OK => 200; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use constant HTTP_CREATED => 201; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use constant HTTP_ACCEPTED => 202; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use constant HTTP_NO_CONTENT => 204; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use constant HTTP_PARTIAL_CONTENT => 206; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use constant HTTP_MOVED_PERMANENTLY => 301; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use constant HTTP_MOVED_TEMPORARILY => 302; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use constant HTTP_REDIRECT => 302; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use constant HTTP_NOT_MODIFIED => 304; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use constant HTTP_BAD_REQUEST => 400; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use constant HTTP_UNAUTHORIZED => 401; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use constant HTTP_PAYMENT_REQUIRED => 402; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use constant HTTP_FORBIDDEN => 403; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use constant HTTP_NOT_FOUND => 404; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use constant HTTP_NOT_ALLOWED => 405; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use constant HTTP_NOT_ACCEPTABLE => 406; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | use constant HTTP_REQUEST_TIME_OUT => 408; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | use constant HTTP_CONFLICT => 409; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | use constant HTTP_GONE => 410; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | use constant HTTP_LENGTH_REQUIRED => 411; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | use constant HTTP_REQUEST_ENTITY_TOO_LARGE => 413; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | use constant HTTP_REQUEST_URI_TOO_LARGE => 414; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | use constant HTTP_UNSUPPORTED_MEDIA_TYPE => 415; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | ▶ | use constant HTTP_RANGE_NOT_SATISFIABLE => 416; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | ▶ | use constant HTTP_INTERNAL_SERVER_ERROR => 500; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | ▶ | use constant HTTP_SERVER_ERROR => 500; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | ▶ | use constant HTTP_NOT_IMPLEMENTED => 501; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | ▶ | use constant HTTP_BAD_GATEWAY => 502; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | ▶ | use constant HTTP_SERVICE_UNAVAILABLE => 503; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | use constant HTTP_GATEWAY_TIME_OUT => 504; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | ▶ | use constant HTTP_INSUFFICIENT_STORAGE => 507; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | ▶ | use Drogo::Cookie; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | ▶ | use Drogo::MultiPart; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | use Time::HiRes qw(gettimeofday tv_interval); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | ▶ | BEGIN { require 5.008004; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # Export all @HTTP_STATUS_CODES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | OK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | DECLINED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | HTTP_OK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | HTTP_CREATED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | HTTP_ACCEPTED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | HTTP_NO_CONTENT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | HTTP_PARTIAL_CONTENT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | HTTP_MOVED_PERMANENTLY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | HTTP_MOVED_TEMPORARILY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | HTTP_REDIRECT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | HTTP_NOT_MODIFIED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | HTTP_BAD_REQUEST | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | HTTP_UNAUTHORIZED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | HTTP_PAYMENT_REQUIRED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | HTTP_FORBIDDEN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | HTTP_NOT_FOUND | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | HTTP_NOT_ALLOWED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | HTTP_NOT_ACCEPTABLE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | HTTP_REQUEST_TIME_OUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | HTTP_CONFLICT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | HTTP_GONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | HTTP_LENGTH_REQUIRED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | HTTP_REQUEST_ENTITY_TOO_LARGE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | HTTP_REQUEST_URI_TOO_LARGE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | HTTP_UNSUPPORTED_MEDIA_TYPE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | HTTP_RANGE_NOT_SATISFIABLE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | HTTP_INTERNAL_SERVER_ERROR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | HTTP_SERVER_ERROR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | HTTP_NOT_IMPLEMENTED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | HTTP_BAD_GATEWAY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | HTTP_SERVICE_UNAVAILABLE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | HTTP_GATEWAY_TIME_OUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | HTTP_INSUFFICIENT_STORAGE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | dispatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | $SIG{__DIE__} = sub { &format_error(shift) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # data for request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | my %request_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | my @error_stack; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | my $die_error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | Drogo::Guts - Shared components used by framework. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 1 | my %request_meta_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | sub dispatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dispatch: called CC=13 SCAR=28.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 15 | my ($r, %params) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 15 | my $class = $params{class}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 15 | my $method = $params{method}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 15 | my $error = $params{error}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 15 | my $bless = $params{bless}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 15 | my $base_class = $params{base_class}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 15 | my $dispatch_url = $params{dispatch_url}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 15 | ▶ | my $post_args = $params{post_args} || [ ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$params{'post_args'} || []
MC/DC100%1/1
$params{'post_args'} || []
$params{'post_args'}
Truth table100%2/2
A
A= $params{'post_args'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # perform server initialization magic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 15 | $r->initialize($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 15 | ▶ | %request_meta_data = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%8/12
$method || 'main'
$error || ''
$bless || ''
$base_class || ''
$dispatch_url || ''
$post_args || []
MC/DC0%0/1
$method || 'main'
$method
MC/DC0%0/1
$error || ''
$error
MC/DC0%0/1
$bless || ''
$bless
MC/DC100%1/1
$base_class || ''
$base_class
MC/DC100%1/1
$dispatch_url || ''
$dispatch_url
MC/DC0%0/1
$post_args || []
$post_args
Truth table50%1/2
A
A= $method
Truth table50%1/2
A
A= $error
Truth table50%1/2
A
A= $bless
Truth table100%2/2
A
A= $base_class
Truth table100%2/2
A
A= $dispatch_url
Truth table50%1/2
A
A= $post_args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | call_class => $class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | call_method => $method || 'main', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | error => $error || '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | bless => $bless || '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | base_class => $base_class || '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | dispatch_url => $dispatch_url || '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | post_args => ($post_args || [ ]), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | server_class => ref($r), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 15 | &_store_request_meta_data($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 15 | ▶ | unless ($method eq 'error') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 15 | @error_stack = ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 15 | $die_error = q[]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 15 | ▶ | return (not $error and $r and $r->can('process_request_method') and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not $error and $r and $r->can("process_request_method") and $r->process_request_method(\&Drogo::Guts::handle_request_body)
not $error and $r and $r->can("process_request_method")
not $error and $r
MC/DC0%0/4
not $error and $r and $r->can("process_request_method") and $r->process_request_method(\&Drogo::Guts::handle_request_body)
not $error
$r
$r->can("process_request_method")
$r->process_request_method(\&Drogo::Guts::handle_request_body)
Truth table20%1/5
not(A) and B and C and D
A= not $errorB= $rC= $r->can("process_request_method")D= $r->process_request_method(\&Drogo::Guts::handle_request_body)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | $r->process_request_method(\&handle_request_body)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ? $r->server_return(OK) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | : &init_dispatcher($r); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | sub cleanup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 30 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanup: called CC=4 SCAR=25.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 30 | ▶ | if ($request_data{request_parts}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | for my $part (@{$request_data{request_parts}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | next unless $part->{fh}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # close each open fh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | eval { $part->{fh}->close }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # unlink file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | unlink($part->{tmp_file}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | =head3 $self->server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | Returns the server object. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 56 | ▶ | sub server { $request_data{server_object} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
server: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | sub set_server { $request_data{server_object} = $_[1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_server: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | =head3 $self->uri | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | Returns the uri. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | sub uri { shift->server->uri } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uri: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | =head3 $self->module_url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | Returns the url associated with the module. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | sub module_url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my @parts = split('/', $request_meta_data{'dispatch_url'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | pop @parts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return join('/', @parts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | =head3 $self->filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | Returns the path filename. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub filename { shift->server->filename } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
filename: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | =head3 $self->request_method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | Returns the request_method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub request_method { shift->server->request_method } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request_method: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | =head3 $self->remote_addr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | Returns the remote_addr. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | sub remote_addr { shift->server->remote_addr } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remote_addr: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | =head3 $self->header_in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | Return value of header_in. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | sub header_in { shift->server->header_in(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header_in: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 15 | ▶ | sub rflush { shift->server->rflush } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rflush: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 15 | ▶ | sub flush { shift->rflush } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flush: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | =head3 $self->print(...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | Output via http. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | sub print | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 13 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 13 | $request_data{output} .= join '', @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 13 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | =head3 $self->auto_header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | Returns true if set, otherwise args 1 sets true and 0 false. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | sub auto_header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
auto_header: called CC=3 SCAR=16.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 15 | my ($self, $arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 15 | ▶ | if (defined $arg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | if ($arg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | delete $request_data{disable_auto_header}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $request_data{disable_auto_header} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 15 | return(not exists $request_data{disable_auto_header}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | =head3 $self->dispatching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | Returns true if we're dispatching actively. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | sub dispatching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 45 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dispatching: called CC=3 SCAR=16.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 45 | my ($self, $arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 45 | ▶ | if (defined $arg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | if ($arg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | delete $request_data{disable_dispatching}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | $request_data{disable_dispatching} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 45 | return(not exists $request_data{disable_dispatching}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | =head3 $self->header_set('header_type', 'value') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | Set output header. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | sub header_set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header_set: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my ($self, $key, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $request_data{headers}{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | =head3 $self->header('content-type') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | Set content type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | sub header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | __PACKAGE__->header_set('Content-Type', $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | =head3 $self->headers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | Returns hashref of response headers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | sub headers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
headers: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | return $request_data{headers}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | =head3 $self->location('url') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | Redirect to a url (sets the Location header out). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | sub location { shift->header_set('Location', shift) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
location: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | =head3 $self->status(...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | Set output status... (200, 404, etc...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | If no argument given, returns status. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | sub status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
status: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 17 | my ($self, $status) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 17 | ▶ | if ($status) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 2 | $request_data{status} = $status; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 15 | return $request_data{status}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | # map $self->log to print STDERR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | sub log { shift; print STDERR @_; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
log: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | =head3 $self->request_part(...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | Returns reference for upload. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 'filename' => 'filename', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 'tmp_file' => '/tmp/drogomp-23198-1330057261', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 'fh' => \*{'Drogo::MultiPart::$request_part{...}'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 'name' => 'foo' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | sub request_part | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request_part: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my ($self, $lookup_key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my @values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | if ($request_data{request_parts}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | for my $part (@{$request_data{request_parts}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | push @values, $part if $lookup_key eq $part->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | return unless @values; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | return (scalar @values == 1 ? $values[0] : @values); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | =head3 $self->param(...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | Return a parameter passed via CGI--works like CGI::param. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 1 | warn 'drogo'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | sub param | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
param: not called CC=13 SCAR=50.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my ($self, $lookup_key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | my @values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | my %seen_hash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | my $request = $request_data{args}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | warn Dumper \%request_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | if ($request_data{request_parts}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | for my $part (@{$request_data{request_parts}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | # don't return uploads here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | next if $part->{fh}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | if ($lookup_key) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | push @values, $part->{data} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | if $lookup_key eq $part->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | next if $seen_hash{$part->{name}}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | push @values, $part->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | my @args = split('&', $request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | for my $arg (@args) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | my ($key, $value) = split('=', $arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | if ($lookup_key) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | push @values, __PACKAGE__->unescape($value) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | if $lookup_key eq $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | next if $seen_hash{$key}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | push @values, $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | return unless @values; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | return (scalar @values == 1 ? $values[0] : @values); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | =head3 $self->param_hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | Return a friendly hashref of CGI parameters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | sub param_hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
param_hash: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | my %param_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | for my $key (__PACKAGE__->param) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | next if $param_hash{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | my @params = __PACKAGE__->param($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | if (scalar @params == 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $param_hash{$key} = $params[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $param_hash{$key} = [ @params ], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | return \%param_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | =head3 $self->request_body & $self->request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | Returns request body. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | ▶ | sub request_body { $request_data{request} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request_body: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | sub request { shift->request_body } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | =head3 $self->request_parts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | Returns arrayref of request parts, used for multipart/form-data requests. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | ▶ | sub request_parts { $request_data{request_parts} || [] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request_parts: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | =head3 $self->args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | Returns args. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | sub args { $request_data{args} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
args: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | =head3 $self->matches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | Returns array of post_arguments (matching path after a matched ActionMatch attribute) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | Returns array of matching elements when used with ActionRegex. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | sub matches { @{ $request_data{post_args} || [ ] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
matches: not called CC=2 SCAR=17.9
Pod
documented
Condition0%0/2
$request_data{'post_args'} || []
MC/DC0%0/1
$request_data{'post_args'} || []
$request_data{'post_args'}
Truth table0%0/2
A
A= $request_data{'post_args'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | =head3 $self->post_args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | Same as matches, deprecated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 5 | ▶ | sub post_args { @{ $request_data{post_args} || [ ] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
post_args: called CC=2 SCAR=7.2
Pod
documented
Condition50%1/2
$request_data{'post_args'} || []
MC/DC0%0/1
$request_data{'post_args'} || []
$request_data{'post_args'}
Truth table50%1/2
A
A= $request_data{'post_args'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | sub handle_request_body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handle_request_body: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | my $r = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | # reinflate $r if necessary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | &_inflate_request_meta_data($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | if (ref($r) ne $request_meta_data{server_class}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | my $server_class = $request_meta_data{server_class}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | $server_class->initialize($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | my $request_body = $r->request_body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | my %params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | # if no args are passed, assume they are in the post | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | if (not $r->args and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $r->args and substr($request_body, 0, 1) ne "{" and index($request_body, "\n") == -1
not $r->args and substr($request_body, 0, 1) ne "{"
MC/DC0%0/3
not $r->args and substr($request_body, 0, 1) ne "{" and index($request_body, "\n") == -1
not $r->args
substr($request_body, 0, 1) ne "{"
index($request_body, "\n") == -1
Truth table0%0/4
not(A) and B and C
A= not $r->argsB= substr($request_body, 0, 1) ne "{"C= index($request_body, "\n") == -1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | substr($request_body, 0, 1) ne '{' and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | index($request_body, "\n") == -1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | $params{args} = $request_body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | else # process multi-line data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | # decode multi-part data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | $params{request_parts} = Drogo::MultiPart::process($r) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | if substr($request_body, 0, 1) eq '-'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | return &init_dispatcher($r, %params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 15 | ▶ | sub init_dispatcher { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_dispatcher: called CC=41 SCAR=62.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 15 | my ($r, %params) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | %request_data = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | headers => { 'Content-Type' => 'text/html' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | output => q[], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | status => 200, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | server_object => $r, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | request => $params{request} || $r->request_body, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | args => $params{args} || $r->args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | request_parts => $params{request_parts}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | begin_time => [gettimeofday], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | post_args => $request_meta_data{post_args}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 15 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$params{'request'} || $r->request_body
$params{'args'} || $r->args
MC/DC0%0/2
$params{'request'} || $r->request_body
$params{'request'}
$r->request_body
MC/DC0%0/2
$params{'args'} || $r->args
$params{'args'}
$r->args
Truth table33%1/3
A || B
A= $params{'request'}B= $r->request_body
Truth table33%1/3
A || B
A= $params{'args'}B= $r->args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 15 | my $class = $request_meta_data{'call_class'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 15 | my $bless = $request_meta_data{'bless'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 15 | my $base_class = $request_meta_data{'base_class'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 15 | my $method = $request_meta_data{'call_method'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 15 | my $self = { }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 15 | ▶ | $bless ? bless($self, $class) : bless($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 15 | my $sub_call = "$class\::$method"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 15 | ▶ | if (UNIVERSAL::can($class, $method)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | # pre-run sub, if defined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 15 | ▶ | my $init_class = $base_class || $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$base_class || $class
MC/DC0%0/2
$base_class || $class
$base_class
$class
Truth table66%2/3
A || B
A= $base_classB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 15 | ▶ | if (UNIVERSAL::can($init_class, 'init') and not $method eq 'error') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
UNIVERSAL::can($init_class, "init") and not $method eq "error"
MC/DC0%0/2
UNIVERSAL::can($init_class, "init") and not $method eq "error"
UNIVERSAL::can($init_class, "init")
not $method eq "error"
Truth table33%1/3
A and not(B)
A= UNIVERSAL::can($init_class, "init")B= not $method eq "error"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | ▶ | local $SIG{__DIE__} = sub { &format_error(shift) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | if ($bless) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | $self->init; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | my $prerun_sub = "$init_class\::init"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | $prerun_sub->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | ▶ | if ($@ and $@ ne "drogo-exit\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$@ and $@ ne "drogo-exit\n"
MC/DC0%0/2
$@ and $@ ne "drogo-exit\n"
$@
$@ ne "drogo-exit\n"
Truth table0%0/3
A and B
A= $@B= $@ ne "drogo-exit\n"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | if ($method eq 'error') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | # you've got an error in your error handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | warn "Error in error handler... ($class\::error)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | return __PACKAGE__->init_error($sub_call); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | # reset request data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | %request_data = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | %request_data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | headers => { 'Content-Type' => 'text/html' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | output => q[], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | status => 200, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | server_object => $r, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | request => $params{request} || $r->request_body, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | args => $params{args} || $r->args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | request_parts => $params{request_parts}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$params{'request'} || $r->request_body
$params{'args'} || $r->args
MC/DC0%0/2
$params{'request'} || $r->request_body
$params{'request'}
$r->request_body
MC/DC0%0/2
$params{'args'} || $r->args
$params{'args'}
$r->args
Truth table0%0/3
A || B
A= $params{'request'}B= $r->request_body
Truth table0%0/3
A || B
A= $params{'args'}B= $r->args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | ▶ | local $SIG{__DIE__} = sub { &format_error(shift) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | ▶ | if ($bless) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | $self->error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | my $prerun_sub = "$init_class\::error"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | $prerun_sub->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | ▶ | if ($@ and $@ ne "drogo-exit\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$@ and $@ ne "drogo-exit\n"
MC/DC0%0/2
$@ and $@ ne "drogo-exit\n"
$@
$@ ne "drogo-exit\n"
Truth table0%0/3
A and B
A= $@B= $@ ne "drogo-exit\n"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | ▶ | if ($method eq 'error') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | # you've got an error in your error handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | warn "Error in error handler... ($class\::error)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | return __PACKAGE__->init_error($sub_call); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | ▶ | __PACKAGE__->process_auto_header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
__PACKAGE__->auto_header and __PACKAGE__->dispatching
MC/DC0%0/2
__PACKAGE__->auto_header and __PACKAGE__->dispatching
__PACKAGE__->auto_header
__PACKAGE__->dispatching
Truth table0%0/3
A and B
A= __PACKAGE__->auto_headerB= __PACKAGE__->dispatching
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | if __PACKAGE__->auto_header and __PACKAGE__->dispatching; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | # cleanup drogo internals from dispatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | &cleanup($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | $r->cleanup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | return $r->server_return(OK); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 15 | my $error = $request_meta_data{'error'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 15 | ▶ | if (__PACKAGE__->dispatching) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 15 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | ▶ | local $SIG{__DIE__} = sub { &format_error(shift) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 15 | my @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 15 | ▶ | push @args, $error if $error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 15 | ▶ | if ($bless) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 15 | $self->$method(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | $sub_call->($self, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 15 | ▶ | if ($@ and $@ ne "drogo-exit\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$@ and $@ ne "drogo-exit\n"
MC/DC0%0/2
$@ and $@ ne "drogo-exit\n"
$@
$@ ne "drogo-exit\n"
Truth table33%1/3
A and B
A= $@B= $@ ne "drogo-exit\n"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | if ($method eq 'error') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | # you've got an error in your error handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | warn "Error in error handler... ($class\::error)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | return __PACKAGE__->init_error($sub_call); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | # reset request data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | %request_data = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | %request_data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | headers => { 'Content-Type' => 'text/html' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | output => q[], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | status => 200, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | server_object => $r, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | request => $params{request} || $r->request_body, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | args => $params{args} || $r->args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | request_parts => $params{request_parts}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$params{'request'} || $r->request_body
$params{'args'} || $r->args
MC/DC0%0/2
$params{'request'} || $r->request_body
$params{'request'}
$r->request_body
MC/DC0%0/2
$params{'args'} || $r->args
$params{'args'}
$r->args
Truth table0%0/3
A || B
A= $params{'request'}B= $r->request_body
Truth table0%0/3
A || B
A= $params{'args'}B= $r->args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | ▶ | local $SIG{__DIE__} = sub { &format_error(shift) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | ▶ | if ($bless) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | $self->error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | my $prerun_sub = "$init_class\::error"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | $prerun_sub->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | ▶ | if ($@ and $@ ne "drogo-exit\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$@ and $@ ne "drogo-exit\n"
MC/DC0%0/2
$@ and $@ ne "drogo-exit\n"
$@
$@ ne "drogo-exit\n"
Truth table0%0/3
A and B
A= $@B= $@ ne "drogo-exit\n"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | ▶ | if ($method eq 'error') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | # you've got an error in your error handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | warn "Error in error handler... ($class\::error)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | return __PACKAGE__->init_error($sub_call); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | ▶ | __PACKAGE__->process_auto_header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
__PACKAGE__->auto_header and __PACKAGE__->dispatching
MC/DC0%0/2
__PACKAGE__->auto_header and __PACKAGE__->dispatching
__PACKAGE__->auto_header
__PACKAGE__->dispatching
Truth table0%0/3
A and B
A= __PACKAGE__->auto_headerB= __PACKAGE__->dispatching
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | if __PACKAGE__->auto_header and __PACKAGE__->dispatching; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | # cleanup drogo internals from dispatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | &cleanup($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | $r->cleanup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | return $r->server_return(OK); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | # process all data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 15 | ▶ | __PACKAGE__->process_auto_header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
__PACKAGE__->auto_header and __PACKAGE__->dispatching
MC/DC0%0/2
__PACKAGE__->auto_header and __PACKAGE__->dispatching
__PACKAGE__->auto_header
__PACKAGE__->dispatching
Truth table33%1/3
A and B
A= __PACKAGE__->auto_headerB= __PACKAGE__->dispatching
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | if __PACKAGE__->auto_header and __PACKAGE__->dispatching; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | # post-run sub, if defined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 15 | ▶ | my $cleanup_class = $base_class || $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$base_class || $class
MC/DC0%0/2
$base_class || $class
$base_class
$class
Truth table66%2/3
A || B
A= $base_classB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 15 | ▶ | if (UNIVERSAL::can($cleanup_class, 'cleanup') and $method ne 'error' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
UNIVERSAL::can($cleanup_class, "cleanup") and $method ne "error" and __PACKAGE__->dispatching
UNIVERSAL::can($cleanup_class, "cleanup") and $method ne "error"
MC/DC0%0/3
UNIVERSAL::can($cleanup_class, "cleanup") and $method ne "error" and __PACKAGE__->dispatching
UNIVERSAL::can($cleanup_class, "cleanup")
$method ne "error"
__PACKAGE__->dispatching
Truth table25%1/4
A and B and C
A= UNIVERSAL::can($cleanup_class, "cleanup")B= $method ne "error"C= __PACKAGE__->dispatching
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | and __PACKAGE__->dispatching) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 15 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | ▶ | local $SIG{__DIE__} = sub { &format_error(shift) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 15 | ▶ | if ($bless) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 15 | $self->cleanup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | my $cleanup_sub = "$cleanup_class\::cleanup"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | $cleanup_sub->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 15 | undef $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | # cleanup drogo internals from dispatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 15 | &cleanup($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 15 | $r->cleanup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 15 | return $r->server_return(OK); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 0 | return __PACKAGE__->init_error($r, $sub_call); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | =head3 detach | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | Stops processing and "exits" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | sub detach { die "drogo-exit\n" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
detach: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | =head3 process_auto_header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | Process the autoheader. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | sub process_auto_header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_auto_header: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 15 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 15 | __PACKAGE__->server->status($self->status); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 15 | my $content_type = delete $request_data{headers}{'Content-Type'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | __PACKAGE__->server->header_out($_, $request_data{headers}{$_}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 15 | for keys %{$request_data{headers}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 15 | __PACKAGE__->server->send_http_header($content_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 15 | $request_data{headers}{'Content-Type'} = $content_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 15 | open(my $ofh, '<', \$request_data{output}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 15 | my $buffer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 15 | ▶ | while (read($ofh, $buffer, 1024)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 11 | __PACKAGE__->server->print($buffer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 15 | close($ofh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 15 | __PACKAGE__->flush; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | sub format_error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_error: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | my $error = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | my @stack = &make_error_stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | $die_error = $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | ▶ | return if $error eq "drogo-exit\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | warn $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | for my $e (@stack) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | warn "$e->{sub} called at $e->{file} line $e->{line}\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | =head3 error_stack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | Returns the "error stack" as an array. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | ▶ | sub error_stack { @error_stack }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error_stack: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | =head3 get_error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | Returns error as string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | ▶ | sub get_error { $die_error }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | sub make_error_stack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_error_stack: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | my @stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | ▶ | while (my @x = caller(++$i)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | push @stack, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | pack => $x[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | file => $x[1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | line => $x[2], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | sub => $x[3], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | shift @stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | shift @stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | pop @stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | @error_stack = @stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | return @stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | sub init_error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_error: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | my ($self, $r, $sub) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | # cleanup drogo internals from dispatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | &cleanup($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | $r->cleanup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | warn(__PACKAGE__ . qq[: '$sub' does not exist...\n]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | unless $sub =~ /error$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | return $r->server_return(HTTP_SERVER_ERROR); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | =head3 $self->unescape | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | Unscape HTTP URI encoding. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | sub unescape | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unescape: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | $value =~ s/\+/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | $value = __PACKAGE__->server->unescape($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | =head3 $self->cookie | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | Cookie methods: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | $self->cookie->set(-name => 'foo', -value => 'bar'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | my %cookies = $self->cookie->read; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | ▶ | sub cookie { new Drogo::Cookie(shift) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cookie: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | =head3 $self->elapsed_time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | Returns elapsed time since initial dispatch. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | ▶ | sub elapsed_time { tv_interval($request_data{begin_time}, [gettimeofday]) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
elapsed_time: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | sub _store_request_meta_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_store_request_meta_data: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 15 | my $r = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | # nginx needs to pass this data between threads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | $r->variable( $_ => $request_meta_data{$_} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 15 | for qw(call_class call_method error bless base_class dispatch_url server_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | # dragons | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 15 | ▶ | $r->variable( post_args => join('|', @{$request_meta_data{post_args} || [ ]}) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$request_meta_data{'post_args'} || []
MC/DC0%0/1
$request_meta_data{'post_args'} || []
$request_meta_data{'post_args'}
Truth table50%1/2
A
A= $request_meta_data{'post_args'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | sub _inflate_request_meta_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_inflate_request_meta_data: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | my $r = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | %request_meta_data = ( ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | $request_meta_data{$_} = $r->variable($_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | for qw(call_class call_method error bless base_class dispatch_url server_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | $request_meta_data{post_args} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | [ split(/\|/, $r->variable('post_args')) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | Bizowie <http://bizowie.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | Copyright (C) 2013 Bizowie | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||