FCGI::...c::PSGI(3pm)

πŸ’– FCGI::Async::PSGI πŸ’–

okay bestie, gather round, because this is the FCGI::Async::PSGI page from the User Contributed Perl Documentation (section 3pm) and it's literally so good. no cap. it's giving "gateway between your webserver and your vibes." ✨


🌸 NAME 🌸

FCGI::Async::PSGI β€” the way that you can use PSGI applications with FCGI::Async. that's the whole assignment and she ATE. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

here's the whole vibe, copy-paste ready, not a single character changed bestie:

use FCGI::Async::PSGI;
use IO::Async::Loop;

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

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

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

$loop->add( $fcgi );

$loop->loop_forever;

like. she's serving a whole Hello, world! on port 12345 and then looping forever like the main character she is. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so FCGI::Async::PSGI is a subclass of FCGI::Async, and what she does is let a FastCGI responder use a PSGI application to respond to requests. she is, lowkey, the gateway bestie standing between the FastCGI connection coming from the webserver and the PSGI application. 🫢

and honestly? aside from using PSGI instead of the on_request callback, this class behaves similarly to FCGI::Async. same energy, new fit. πŸ’…


✨ PARAMETERS ✨

you can pass these named parameters to new or to configure β€” yes, both, she's flexible:

  • app => CODE β€” a reference to the actual PSGI application that's gonna do the responding to requests. this is the one, the moment, the icon. πŸŽ€

🌈 PSGI ENVIRONMENT 🌈

these extra keys get supplied to the environment of your PSGI app β€” freebies, gifts, little treats:

  • "fcgi.async" β€” the FCGI::Async::PSGI object that's serving this request. it's her. πŸ‘‘
  • "fcgi.async.req" β€” the FCGI::Async::Request object representing this particular request. iykyk. πŸ’œ
  • "io.async.loop" β€” the IO::Async::Loop object that the FCGI::Async::PSGI object is a member of.
okay important note bestie: that loop is also provided as fcgi.async.loop for backward-compatibility with version 0.21, but at some point it will be removed. so like... don't build your whole personality around it. πŸ™ˆ

πŸ’€ SEE ALSO πŸ’€

  • PSGI β€” Perl Web Server Gateway Interface Specification
  • Plack::Handler::FCGI::Async β€” FastCGI handler for Plack using FCGI::Async

🌸 AUTHOR 🌸

Paul Evans <leonerd@leonerd.org.uk> β€” thank you for your service king 🫑


and that's the page!! brought to you by perl v5.32.0, dated 2021-01-09, straight out of the User Contributed Perl Documentation for FCGI::Async::PSGI(3pm). go forth and serve those requests bestie, periodt. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from