line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Mini::Webserver::PSGI; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
136478
|
$CPAN::Mini::Webserver::PSGI::VERSION = '0.01'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1905
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use CGI; |
9
|
|
|
|
|
|
|
use CGI::Emulate::PSGI; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'CPAN::Mini::Webserver'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub to_app { |
14
|
|
|
|
|
|
|
my ( $self ) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$self = $self->new unless ref($self); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$self->after_setup_listener; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return CGI::Emulate::PSGI->handler(sub { |
21
|
|
|
|
|
|
|
CGI::initialize_globals(); |
22
|
|
|
|
|
|
|
my $cgi = CGI->new; |
23
|
|
|
|
|
|
|
return $self->handle_request($cgi); |
24
|
|
|
|
|
|
|
}); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
around send_http_header => sub { |
28
|
|
|
|
|
|
|
my ( $orig, $self, $code, %params ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$params{'-status'} = $code; |
31
|
|
|
|
|
|
|
return $self->$orig($code, %params); |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=pod |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
CPAN::Mini::Webserver::PSGI - Use CPAN::Mini::Webserver as a PSGI application |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 VERSION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
version 0.01 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# in your app.psgi file |
51
|
|
|
|
|
|
|
use strict; |
52
|
|
|
|
|
|
|
use warnings; |
53
|
|
|
|
|
|
|
use CPAN::Mini::Webserver::PSGI; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
CPAN::Mini::Webserver::PSGI->new->to_app; |
56
|
|
|
|
|
|
|
# or CPAN::Mini::Webserver::PSGI->to_app as a shortcut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
CPAN::Mini::Webserver::PSGI is a simple extension of L<CPAN::Mini::Webserver> |
61
|
|
|
|
|
|
|
that allows you to use L<CPAN::Mini::Webserver>'s functionality in a L<PSGI> |
62
|
|
|
|
|
|
|
application. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
CPAN::Mini::PSGIApp might be a better name for this module, but I wanted to |
65
|
|
|
|
|
|
|
reflect its relationship to L<CPAN::Mini::Webserver>. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 METHODS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This is a subclass of <CPAN::Mini::Webserver>, so it inherits all of its |
70
|
|
|
|
|
|
|
methods. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 to_app |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Returns the L<PSGI> application for this CPAN::Mini::Webserver::PSGI instance. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SEE ALSO |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
L<CPAN::Mini::Webserver>, L<PSGI> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Rob Hoelz <rob@hoelz.ro> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Rob Hoelz. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
89
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# ABSTRACT: Use CPAN::Mini::Webserver as a PSGI application |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|