FCGI::Async(3pm)
π NAME π
FCGI::Async β it's giving FastCGI meets IO::Async, bestie π¦
β¨ SYNOPSIS β¨
okay so here's the whole vibe, copy-paste ready:
use FCGI::Async;
use IO::Async::Loop;
my $loop = IO::Async::Loop->new();
my $fcgi = FCGI::Async->new(
loop => $loop
service => 1234,
on_request => sub {
my ( $fcgi, $req ) = @_;
# Handle the request here
}
);
$loop->loop_forever;
and that's it, that's the whole thing, slay π
πΈ DESCRIPTION πΈ
So FCGI::Async is a subclass of Net::Async::FastCGI, and ngl its API is slightly different β that's the whole point. Where the normal one wants you to add it as a Notifier object inside an IO::Async::Loop, this one is fine with you just handing it an argument that contains the IO::Async::Loop object instead. Same energy, different handshake. π«Ά
But listen β and this is the important bit β it exists mostly as a backward-compatibility wrapper for older code that was already doing the thing this way. If your code is new? Then bestie, do yourself a favor and use the Net::Async::FastCGI interface directly. This one is literally the nostalgia tour. π
π CONSTRUCTOR π
$fcgi = FCGI::Async->new( %args )
Returns a new instance of a FCGI::Async object. Iconic behavior, honestly. β¨
Now here's the tea β β if you pass either a handle or a service argument to the constructor, then a couple things happen in order, no cap:
- the freshly-created object gets added to the
IO::Async::Loopyou gave it, - then the
listenmethod gets invoked, and the entire%argshash gets passed straight to it. All of it. Every last key. π«‘
And if you pass either of those two arguments above, then you also have to provide an IO::Async::Loop:
loop => IO::Async::Loopβ a reference to theIO::Async::Loopthat's gonna be holding your listening sockets. That's its whole job. It's the main character of your event loop. π
β οΈ heads up fr fr:handle/servicewithout aloop? Not a vibe. You need the loop, periodt.
π¦ AUTHOR π¦
Paul Evans <leonerd@leonerd.org.uk> π β thank you for your service, king.
and that's the page!! this was User Contributed Perl Documentation, coming at you from perl v5.32.0, dated 2021-01-09 π go forth and FastCGI responsibly, bestie, ily πβ¨
π¦ where this page comes from
- debian bookworm: libfcgi-async-perl 0.22-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libfcgi-async-perl 0.22-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libfcgi-async-perl 0.22-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libfcgi-async-perl 0.22-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libfcgi-async-perl 0.22-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfcgi-async-perl 0.22-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms