line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Labyrinth::PSGI; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
82916
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
151
|
|
4
|
5
|
|
|
5
|
|
19
|
use strict; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
183
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.02'; |
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
3239
|
use Labyrinth; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Labyrinth::Variables; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
|
|
|
|
|
|
my ($class,$env,$cnf) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $lab = Labyrinth->new(); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# create an attributes hash |
17
|
|
|
|
|
|
|
my $atts = { |
18
|
|
|
|
|
|
|
cnf => $cnf, |
19
|
|
|
|
|
|
|
lab => $lab |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# create the object |
23
|
|
|
|
|
|
|
bless $atts, $class; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$settings{psgi}{env} = $env; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
return $atts; |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub run { |
31
|
|
|
|
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
my $cnf = shift || $self->{cnf}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return [ 500, 'text/html', [ 'Oops!Oops, something went wrong' ] ] |
35
|
|
|
|
|
|
|
unless($cnf && -f $cnf); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$self->{lab}->run( $cnf ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
return [ $settings{psgi}{status}, $settings{psgi}{headers}, [ $settings{psgi}{body} ] ]; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |