line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::RPC::Server::FastCGI; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24828
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
5
|
1
|
|
|
1
|
|
1029
|
use CGI::Fast; |
|
1
|
|
|
|
|
28528
|
|
|
1
|
|
|
|
|
36
|
|
6
|
1
|
|
|
1
|
|
74
|
use base qw(JSON::RPC::Server::CGI); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1035
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
JSON::RPC::Server::FastCGI - A FastCGI version of JSON::RPC::Server |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.03 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use JSON::RPC::Server::FastCGI; |
23
|
|
|
|
|
|
|
use lib 'libs/'; # you could put your handler modules here |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# If you want to use an 'External' FastCGI Server: |
26
|
|
|
|
|
|
|
# $ENV{FCGI_SOCKET_PATH} = "elsewhere:8888"; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $server = JSON::RPC::Server::FastCGI->new; |
29
|
|
|
|
|
|
|
$server->dispatch_to('MyApp')->handle(); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 new |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Creates a server. All that needs to be done is call dispatch (or dispatch_to) |
36
|
|
|
|
|
|
|
followed by $server->handle(). |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
# We cannot use the direct parent method (JSON::RPC::Server::CGI::new); |
40
|
|
|
|
|
|
|
# though we are a subclass of JSON::RPC::Server::CGI, we cannot |
41
|
|
|
|
|
|
|
# invoke it's constructor since it is per-request, and FastCGI is not. |
42
|
|
|
|
|
|
|
# That's why we just use the more general grand-parent constructor. |
43
|
|
|
|
|
|
|
sub new { |
44
|
0
|
|
|
0
|
1
|
|
my $self = JSON::RPC::Server::new(@_); |
45
|
0
|
|
|
|
|
|
$self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 OVERRIDDEN METHODS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 handle |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This is exactly the same as $server->handle, except |
53
|
|
|
|
|
|
|
that it uses an instance of CGI::Fast instead of CGI. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub handle { |
58
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
59
|
0
|
|
|
|
|
|
my $cgi; |
60
|
0
|
|
|
|
|
|
while ($cgi = new CGI::Fast) { |
61
|
0
|
|
|
|
|
|
$self->request( HTTP::Request->new($cgi->request_method, $cgi->url) ); |
62
|
0
|
|
|
|
|
|
$self->{_cgi} = $cgi; |
63
|
0
|
|
|
|
|
|
$self->SUPER::handle(); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 cgi |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Returns the CGI::Fast object associated with this server. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub cgi { |
74
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
75
|
0
|
|
|
|
|
|
return $self->{_cgi}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 METHODS |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Pretty much the same as JSON::RPC::Server; |
82
|
|
|
|
|
|
|
(See L) |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Faiz Kazi, C<< >> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 BUGS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
92
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
93
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SUPPORT |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
perldoc JSON::RPC::Server::FastCGI |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
You can also look for information at: |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=over 4 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * CPAN Ratings |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * Search CPAN |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=back |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Copyright 2008 Faiz Kazi, all rights reserved. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
134
|
|
|
|
|
|
|
under the same terms as Perl itself. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; # End of JSON::RPC::Server::FastCGI |