logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

"Net::Async::FastCGI::PSGI" - use "PSGI" applications with "Net::Async::FastCGI"

Author

       Paul Evans <leonerd@leonerd.org.uk>

perl v5.38.2                                       2024-07-29                     Net::Async::FastCGI::PSGI(3pm)

Description

       This subclass of Net::Async::FastCGI allows a FastCGI responder to use a PSGI application to respond to
       requests. It acts as a gateway between the FastCGI connection from the webserver, and the "PSGI"
       application. Aside from the use of "PSGI" instead of the "on_request" event, this class behaves similarly
       to "Net::Async::FastCGI".

Name

       "Net::Async::FastCGI::PSGI" - use "PSGI" applications with "Net::Async::FastCGI"

Parameters

       The following named parameters may be passed to "new" or "configure":

       app => CODE
               Reference to the actual "PSGI" application to use for responding to requests

Psgi Environment

       The following extra keys are supplied to the environment of the "PSGI" app:

       "net.async.fastcgi"
               The "Net::Async::FastCGI::PSGI" object serving the request

       "net.async.fastcgi.req"
               The Net::Async::FastCGI::Request object representing this particular request

       "io.async.loop"
               The IO::Async::Loop object that the "Net::Async::FastCGI::PSGI" object is a member of.

See Also

       •   PSGI - Perl Web Server Gateway Interface Specification

       •   Plack::Handler::Net::Async::FastCGI - FastCGI handler for Plack using Net::Async::FastCGI

Synopsis

          use Net::Async::FastCGI::PSGI;
          use IO::Async::Loop;

          my $loop = IO::Async::Loop->new;

          my $fcgi = Net::Async::FastCGI::PSGI->new(
             port => 12345,
             app => sub {
                my $env = shift;

                return [
                   200,
                   [ "Content-Type" => "text/plain" ],
                   [ "Hello, world!" ],
                ];
             },
          );

          $loop->add( $fcgi );

          $loop->run;

See Also