Stefan de Konink dijo [Sun, Feb 08, 2009 at 10:19:17AM +0100]:
> Chav Paskov wrote:
> > Help me to understand something here.
> Please post to the mailinglist.
>
> > i Do have a FCGI perl script that works under apache as we speak
> > i did not have to set unixsocket or port in order to run it .
> > Can you pls give me a hint how to create the socket?
>
> In that case most likely you are talking about a CGI script.
...But if you are talking about a CGI script, you are _not_ talking
abouty high performance ;-)
To write a Perl program using FastCGI, you should use the FCGI module
[1]. Quoting from the man page:
use FCGI;
my $count = 0;
my $request = FCGI::Request();
while($request->Accept() >= 0) {
print("Content-type: text/html\r\n\r\n", ++$count);
}
So, basically: You need to change the way your program works, if you
are working in a traditional CGI way, so that instead of producing the
output each time the script is invoked, the setup (i.e. all needed
initialization - database connection, etc.) is performed once at the
beginning, and a request loop is created inside which each program
call is received and served.
There are several additional modules you might want to look into, such
as FCGI::Async (for asynchronous use), with slightly different
semantics, FCGI::Spawn (if you want to code closer to the bones), or
Mojo::Server::FCGI::Prefork (a preforking FastCGI implementation using
FCGI, with several simplifications).
You might be tempted to keep your old-fashioned code basically just by
replacing the CGI module for CGI::Fast - DON'T do it. CGI::Fast is not
threadable and requests will block each other.
Greetings,
[1] http://search.cpan.org/~skimo/FCGI-0.67/FCGI.PL
--
Gunnar Wolf - [email protected] - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973 F800 D80E F35A 8BB5 27AF
_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee