Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "CGI::Fast 3" | |
132 | .TH CGI::Fast 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide" | |
133 | .SH "NAME" | |
134 | CGI::Fast \- CGI Interface for Fast CGI | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 12 | |
138 | \& use CGI::Fast qw(:standard); | |
139 | \& $COUNTER = 0; | |
140 | \& while (new CGI::Fast) { | |
141 | \& print header; | |
142 | \& print start_html("Fast CGI Rocks"); | |
143 | ||
144 | \& h1("Fast CGI Rocks"), | |
145 | \& "Invocation number ",b($COUNTER++), | |
146 | \& " PID ",b($$),".", | |
147 | \& hr; | |
148 | \& print end_html; | |
149 | \& } | |
150 | .Ve | |
151 | .SH "DESCRIPTION" | |
152 | .IX Header "DESCRIPTION" | |
153 | CGI::Fast is a subclass of the \s-1CGI\s0 object created by | |
154 | \&\s-1CGI\s0.pm. It is specialized to work well with the Open Market | |
155 | FastCGI standard, which greatly speeds up \s-1CGI\s0 scripts by | |
156 | turning them into persistently running server processes. Scripts | |
157 | that perform time-consuming initialization processes, such as | |
158 | loading large modules or opening persistent database connections, | |
159 | will see large performance improvements. | |
160 | .SH "OTHER PIECES OF THE PUZZLE" | |
161 | .IX Header "OTHER PIECES OF THE PUZZLE" | |
162 | In order to use CGI::Fast you'll need a FastCGI-enabled Web | |
163 | server. Open Market's server is FastCGI\-savvy. There are also | |
164 | freely redistributable FastCGI modules for \s-1NCSA\s0 httpd 1.5 and Apache. | |
165 | FastCGI-enabling modules for Microsoft Internet Information Server and | |
166 | Netscape Communications Server have been announced. | |
167 | .PP | |
168 | In addition, you'll need a version of the Perl interpreter that has | |
169 | been linked with the FastCGI I/O library. Precompiled binaries are | |
170 | available for several platforms, including \s-1DEC\s0 Alpha, HP-UX and | |
171 | SPARC/Solaris, or you can rebuild Perl from source with patches | |
172 | provided in the FastCGI developer's kit. The FastCGI Perl interpreter | |
173 | can be used in place of your normal Perl without ill consequences. | |
174 | .PP | |
175 | You can find FastCGI modules for Apache and \s-1NCSA\s0 httpd, precompiled | |
176 | Perl interpreters, and the FastCGI developer's kit all at \s-1URL:\s0 | |
177 | .PP | |
178 | .Vb 1 | |
179 | \& http://www.fastcgi.com/ | |
180 | .Ve | |
181 | .SH "WRITING FASTCGI PERL SCRIPTS" | |
182 | .IX Header "WRITING FASTCGI PERL SCRIPTS" | |
183 | FastCGI scripts are persistent: one or more copies of the script | |
184 | are started up when the server initializes, and stay around until | |
185 | the server exits or they die a natural death. After performing | |
186 | whatever one-time initialization it needs, the script enters a | |
187 | loop waiting for incoming connections, processing the request, and | |
188 | waiting some more. | |
189 | .PP | |
190 | A typical FastCGI script will look like this: | |
191 | .PP | |
192 | .Vb 6 | |
193 | \& #!/usr/local/bin/perl # must be a FastCGI version of perl! | |
194 | \& use CGI::Fast; | |
195 | \& &do_some_initialization(); | |
196 | \& while ($q = new CGI::Fast) { | |
197 | \& &process_request($q); | |
198 | \& } | |
199 | .Ve | |
200 | .PP | |
201 | Each time there's a new request, CGI::Fast returns a | |
202 | \&\s-1CGI\s0 object to your loop. The rest of the time your script | |
203 | waits in the call to \fInew()\fR. When the server requests that | |
204 | your script be terminated, \fInew()\fR will return undef. You can | |
205 | of course exit earlier if you choose. A new version of the | |
206 | script will be respawned to take its place (this may be | |
207 | necessary in order to avoid Perl memory leaks in long-running | |
208 | scripts). | |
209 | .PP | |
210 | \&\s-1CGI\s0.pm's default \s-1CGI\s0 object mode also works. Just modify the loop | |
211 | this way: | |
212 | .PP | |
213 | .Vb 3 | |
214 | \& while (new CGI::Fast) { | |
215 | \& &process_request; | |
216 | \& } | |
217 | .Ve | |
218 | .PP | |
219 | Calls to \fIheader()\fR, \fIstart_form()\fR, etc. will all operate on the | |
220 | current request. | |
221 | .SH "INSTALLING FASTCGI SCRIPTS" | |
222 | .IX Header "INSTALLING FASTCGI SCRIPTS" | |
223 | See the FastCGI developer's kit documentation for full details. On | |
224 | the Apache server, the following line must be added to srm.conf: | |
225 | .PP | |
226 | .Vb 1 | |
227 | \& AddType application/x-httpd-fcgi .fcgi | |
228 | .Ve | |
229 | .PP | |
230 | FastCGI scripts must end in the extension .fcgi. For each script you | |
231 | install, you must add something like the following to srm.conf: | |
232 | .PP | |
233 | .Vb 1 | |
234 | \& FastCgiServer /usr/etc/httpd/fcgi-bin/file_upload.fcgi -processes 2 | |
235 | .Ve | |
236 | .PP | |
237 | This instructs Apache to launch two copies of file_upload.fcgi at | |
238 | startup time. | |
239 | .SH "USING FASTCGI SCRIPTS AS CGI SCRIPTS" | |
240 | .IX Header "USING FASTCGI SCRIPTS AS CGI SCRIPTS" | |
241 | Any script that works correctly as a FastCGI script will also work | |
242 | correctly when installed as a vanilla \s-1CGI\s0 script. However it will | |
243 | not see any performance benefit. | |
244 | .SH "EXTERNAL FASTCGI SERVER INVOCATION" | |
245 | .IX Header "EXTERNAL FASTCGI SERVER INVOCATION" | |
246 | FastCGI supports a \s-1TCP/IP\s0 transport mechanism which allows FastCGI scripts to run | |
247 | external to the webserver, perhaps on a remote machine. To configure the | |
248 | webserver to connect to an external FastCGI server, you would add the following | |
249 | to your srm.conf: | |
250 | .PP | |
251 | .Vb 1 | |
252 | \& FastCgiExternalServer /usr/etc/httpd/fcgi-bin/file_upload.fcgi -host sputnik:8888 | |
253 | .Ve | |
254 | .PP | |
255 | Two environment variables affect how the \f(CW\*(C`CGI::Fast\*(C'\fR object is created, | |
256 | allowing \f(CW\*(C`CGI::Fast\*(C'\fR to be used as an external FastCGI server. (See \f(CW\*(C`FCGI\*(C'\fR | |
257 | documentation for \f(CW\*(C`FCGI::OpenSocket\*(C'\fR for more information.) | |
258 | .IP "\s-1FCGI_SOCKET_PATH\s0" 4 | |
259 | .IX Item "FCGI_SOCKET_PATH" | |
260 | The address (\s-1TCP/IP\s0) or path (\s-1UNIX\s0 Domain) of the socket the external FastCGI | |
261 | script to which bind an listen for incoming connections from the web server. | |
262 | .IP "\s-1FCGI_LISTEN_QUEUE\s0" 4 | |
263 | .IX Item "FCGI_LISTEN_QUEUE" | |
264 | Maximum length of the queue of pending connections. | |
265 | .PP | |
266 | For example: | |
267 | .PP | |
268 | .Vb 8 | |
269 | \& #!/usr/local/bin/perl # must be a FastCGI version of perl! | |
270 | \& use CGI::Fast; | |
271 | \& &do_some_initialization(); | |
272 | \& $ENV{FCGI_SOCKET_PATH} = "sputnik:8888"; | |
273 | \& $ENV{FCGI_LISTEN_QUEUE} = 100; | |
274 | \& while ($q = new CGI::Fast) { | |
275 | \& &process_request($q); | |
276 | \& } | |
277 | .Ve | |
278 | .SH "CAVEATS" | |
279 | .IX Header "CAVEATS" | |
280 | I haven't tested this very much. | |
281 | .SH "AUTHOR INFORMATION" | |
282 | .IX Header "AUTHOR INFORMATION" | |
283 | Copyright 1996\-1998, Lincoln D. Stein. All rights reserved. | |
284 | .PP | |
285 | This library is free software; you can redistribute it and/or modify | |
286 | it under the same terms as Perl itself. | |
287 | .PP | |
288 | Address bug reports and comments to: lstein@cshl.org | |
289 | .SH "BUGS" | |
290 | .IX Header "BUGS" | |
291 | This section intentionally left blank. | |
292 | .SH "SEE ALSO" | |
293 | .IX Header "SEE ALSO" | |
294 | CGI::Carp, \s-1CGI\s0 |