/usr/lib/x86_64-linux-gnu/perl5/5.24/FCGI.pm is in libfcgi-perl 0.78-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | package FCGI;
use strict;
BEGIN {
our $VERSION = '0.78';
require XSLoader;
XSLoader::load(__PACKAGE__, $VERSION);
}
sub FAIL_ACCEPT_ON_INTR () { 1 };
sub Request(;***$*$) {
my @defaults = (\*STDIN, \*STDOUT, \*STDERR, \%ENV, 0, FAIL_ACCEPT_ON_INTR);
$_[4] = fileno($_[4]) if defined($_[4]) && defined(fileno($_[4]));
splice @defaults,0,@_,@_;
&RequestX(@defaults);
}
package FCGI::Stream;
use strict;
sub PRINTF {
shift->PRINT(sprintf(shift, @_));
}
sub BINMODE {
}
sub READLINE {
my $stream = shift;
my ($s, $c);
my $rs = $/ eq '' ? "\n\n" : $/;
my $l = substr $rs, -1;
my $len = length $rs;
$c = $stream->GETC();
if ($/ eq '') {
while ($c eq "\n") {
$c = $stream->GETC();
}
}
while (defined $c) {
$s .= $c;
last if $c eq $l and substr($s, -$len) eq $rs;
$c = $stream->GETC();
}
$s;
}
sub OPEN {
require Carp;
Carp::croak(q/Operation 'OPEN' not supported on FCGI::Stream handle/);
}
sub SEEK {
require Carp;
Carp::croak(q/Operation 'SEEK' not supported on FCGI::Stream handle/);
}
sub TELL {
require Carp;
Carp::croak(q/Operation 'TELL' not supported on FCGI::Stream handle/);
}
sub TIEHANDLE {
require Carp;
Carp::croak(q/Operation 'TIEHANDLE' not supported on FCGI::Stream handle/);
}
1;
=pod
=head1 NAME
FCGI - Fast CGI module
=head1 SYNOPSIS
use FCGI;
my $count = 0;
my $request = FCGI::Request();
while($request->Accept() >= 0) {
print("Content-type: text/html\r\n\r\n", ++$count);
}
=head1 DESCRIPTION
Functions:
=over 4
=item FCGI::Request
Creates a request handle. It has the following optional parameters:
=over 8
=item input perl file handle (default: \*STDIN)
=item output perl file handle (default: \*STDOUT)
=item error perl file handle (default: \*STDERR)
These filehandles will be setup to act as input/output/error
on successful Accept.
=item environment hash reference (default: \%ENV)
The hash will be populated with the environment.
=item socket (default: 0)
Socket to communicate with the server.
Can be the result of the OpenSocket function.
For the moment, it's the file descriptor of the socket
that should be passed. This may change in the future.
You should only use your own socket if your program
is not started by a process manager such as mod_fastcgi
(except for the FastCgiExternalServer case) or cgi-fcgi.
If you use the option, you have to let your FastCGI
server know which port (and possibly server) your program
is listening on.
See remote.pl for an example.
=item flags (default: 0)
Possible values:
=over 12
=item FCGI::FAIL_ACCEPT_ON_INTR
If set, Accept will fail if interrupted.
It not set, it will just keep on waiting.
=back
=back
Example usage:
my $req = FCGI::Request;
or:
my %env;
my $in = new IO::Handle;
my $out = new IO::Handle;
my $err = new IO::Handle;
my $req = FCGI::Request($in, $out, $err, \%env);
=item FCGI::OpenSocket(path, backlog)
Creates a socket suitable to use as an argument to Request.
=over 8
=item path
Pathname of socket or colon followed by local tcp port.
Note that some systems take file permissions into account
on Unix domain sockets, so you'll have to make sure that
the server can write to the created file, by changing
the umask before the call and/or changing permissions and/or
group of the file afterwards.
=item backlog
Maximum length of the queue of pending connections.
If a connection
request arrives with the queue full the client may receive
an error with an indication of ECONNREFUSED.
=back
=item FCGI::CloseSocket(socket)
Close a socket opened with OpenSocket.
=item $req->Accept()
Accepts a connection on $req, attaching the filehandles and
populating the environment hash.
Returns 0 on success.
If a connection has been accepted before, the old
one will be finished first.
Note that unlike with the old interface, no die and warn
handlers are installed by default. This means that if
you are not running an sfio enabled perl, any warn or
die message will not end up in the server's log by default.
It is advised you set up die and warn handlers yourself.
FCGI.pm contains an example of die and warn handlers.
=item $req->Finish()
Finishes accepted connection.
Also detaches filehandles.
=item $req->Flush()
Flushes accepted connection.
=item $req->Detach()
Temporarily detaches filehandles on an accepted connection.
=item $req->Attach()
Re-attaches filehandles on an accepted connection.
=item $req->LastCall()
Tells the library not to accept any more requests on this handle.
It should be safe to call this method from signal handlers.
Note that this method is still experimental and everything
about it, including its name, is subject to change.
=item $env = $req->GetEnvironment()
Returns the environment parameter passed to FCGI::Request.
=item ($in, $out, $err) = $req->GetHandles()
Returns the file handle parameters passed to FCGI::Request.
=item $isfcgi = $req->IsFastCGI()
Returns whether or not the program was run as a FastCGI.
=back
=head1 LIMITATIONS
FCGI.pm isn't Unicode aware, only characters within the range 0x00-0xFF are
supported. Attempts to output strings containing characters above 0xFF results
in a exception: (F) C<Wide character in %s>.
Users who wants the previous (FCGI.pm <= 0.68) incorrect behavior can disable the
exception by using the C<bytes> pragma.
{
use bytes;
print "\x{263A}";
}
=head1 AUTHOR
Sven Verdoolaege <skimo@kotnet.org>
=head1 COPYRIGHT AND LICENCE
This software is copyrighted (c) 1996 by by Open Market, Inc.
See the LICENSE file in this distribution for information on usage and
redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
=cut
__END__
|