line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Application::PSGI; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
18571
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
100
|
|
4
|
2
|
|
|
2
|
|
123
|
use 5.008_001; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
289
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1898
|
use CGI::PSGI; |
|
2
|
|
|
|
|
84296
|
|
|
2
|
|
|
|
|
30
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub run { |
10
|
0
|
|
|
0
|
0
|
|
my($class, $app) = @_; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# HACK: deprecate HTTP header generation |
13
|
|
|
|
|
|
|
# -- CGI::Application should support some flag to turn this off cleanly |
14
|
0
|
|
|
|
|
|
my $body = do { |
15
|
2
|
|
|
2
|
|
188
|
no warnings 'redefine'; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
490
|
|
16
|
0
|
|
|
0
|
|
|
local *CGI::Application::_send_headers = sub { '' }; |
|
0
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
local $ENV{CGI_APP_RETURN_ONLY} = 1; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
$app->run; |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $q = $app->query; |
23
|
0
|
|
|
|
|
|
my $type = $app->header_type; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my @headers; |
26
|
0
|
0
|
|
|
|
|
if ($type eq 'redirect') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my %props = $app->header_props; |
28
|
0
|
|
0
|
|
|
|
$props{'-location'} ||= delete $props{'-url'} || delete $props{'-uri'}; |
|
|
|
0
|
|
|
|
|
29
|
0
|
|
|
|
|
|
@headers = $q->psgi_header(-Status => 302, %props); |
30
|
|
|
|
|
|
|
} elsif ($type eq 'header') { |
31
|
0
|
|
|
|
|
|
@headers = $q->psgi_header($app->header_props); |
32
|
|
|
|
|
|
|
} elsif ($type eq 'none') { |
33
|
0
|
|
|
|
|
|
Carp::croak("header_type of 'none' is not support by CGI::Application::PSGI"); |
34
|
|
|
|
|
|
|
} else { |
35
|
0
|
|
|
|
|
|
Carp::croak("Invalid header_type '$type'"); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return [ @headers, [ $body ] ]; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |