Net::A...I::PSGI(3pm)

πŸ“¦
version 0.26 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ NAME ✨

ok so bestie, meet Net::Async::FastCGI::PSGI β€” it's the little icon that lets you use PSGI applications with Net::Async::FastCGI. no cap. πŸ’–


🌸 SYNOPSIS 🌸

like, here's the whole vibe in one go:

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;

look at her go πŸ¦‹ she's serving hello world and looking stunning doing it.


πŸ’… DESCRIPTION πŸ’…

okay so real talk: this is a subclass of Net::Async::FastCGI, and what she does is let a FastCGI responder use a PSGI application to respond to requests. she's literally the gateway bestie between the FastCGI connection coming in from the webserver and the PSGI application on the other side. 🫢

the one thing that's different? instead of the on_request event, you get PSGI. that's it. aside from that glow-up, this class behaves similarly to Net::Async::FastCGI. same energy, new fit. ✨


πŸŽ€ PARAMETERS πŸŽ€

these named parameters can be passed to new or configure, iykyk:

  • app => CODE β€” a reference to the actual PSGI application you want to use for responding to requests. yes, it's a coderef. yes, it's the main character. πŸ‘‘

🌈 PSGI ENVIRONMENT 🌈

the environment of the PSGI app gets these extra keys handed to it, and they're lowkey essential:

  • "net.async.fastcgi" β€” the Net::Async::FastCGI::PSGI object that's serving the request. it's giving selfie πŸ“Έ
  • "net.async.fastcgi.req" β€” the Net::Async::FastCGI::Request object representing this particular request. every request gets her own moment. πŸ’«
  • "io.async.loop" β€” the IO::Async::Loop object that the Net::Async::FastCGI::PSGI object is a member of. found family fr fr. 🧚

⭐ SEE ALSO ⭐

  • PSGI - Perl Web Server Gateway Interface Specification
  • Plack::Handler::Net::Async::FastCGI - FastCGI handler for Plack using Net::Async::FastCGI

go read those, bestie, they're part of the lore πŸ“š


πŸ‘‘ AUTHOR πŸ‘‘

Paul Evans <leonerd@leonerd.org.uk>


and that's the whole page, no crumbs left πŸ’œ this one's from perl v5.38.2, dated 2024-07-29 β€” written up by the User Contributed Perl Documentation crew. slay, periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from