AnyEvent::FCGI(3pm)
β¨ AnyEvent::FCGI π
okay bestie, so this is a page from the User Contributed Perl Documentation section of your friendly neighbourhood manual, and it's all about AnyEvent::FCGI β a non-blocking FastCGI server. yes. that's the whole vibe. non-blocking. FastCGI. server. slay. π«Ά
πΈ NAME πΈ
AnyEvent::FCGI β non-blocking FastCGI server. that's it, that's the name, and honestly? iconic. π
β¨ SYNOPSIS β¨
here's the moment you've been waiting for, the little taste test, the vibe check in code form:
use AnyEvent;
use AnyEvent::FCGI;
my $fcgi = new AnyEvent::FCGI(
port => 9000,
on_request => sub {
my $request = shift;
$request->respond(
'OH HAI! QUERY_STRING is ' . $request->param('QUERY_STRING'),
'Content-Type' => 'text/plain',
);
}
);
my $timer = AnyEvent->timer(
after => 10,
interval => 0,
cb => sub {
# shut down server after 10 seconds
$fcgi = undef;
}
);
AnyEvent->loop;
not me getting emotional over a # shut down server after 10 seconds comment π she really said "know your limits, queen".
π DESCRIPTION π
so basically: this module implements a non-blocking FastCGI server for event based applications. that's the whole plot. no cap. π₯
π METHODS π
new
this function creates a new FastCGI server and hands you back a fresh, brand-new instance of a AnyEvent::FCGI object. π¦
and bestie, listen β to shut down the server you just remove all references to this object. that's the whole shutdown ritual. let it go, let it float into the void, garbage collector does the rest. periodt. π
π PARAMETERS π
port => $portβ the TCP port the FastCGI server will listen on. pick a good one, she's staying a while. πhost => $hostβ the TCP address the FastCGI server will listen on. if it's undefined,0.0.0.0gets used instead. no host? no problem,0.0.0.0is the default bestie. β¨socket => $pathβ path to a UNIX domain socket to listen on. and heads up: if you specify this, thehostandportparameters get ignored. completely. ghosted. π she said "unix socket is my main character now".on_request => sub { }β a reference to a handler that gets called when a new FastCGI request shows up. she will be invoked as:
$on_request->($request)
where $request is gonna be a brand spanking new AnyEvent::FCGI::Request object. π
backlog => $backlogβ optional, bestie. an integer number of socket backlog (that's the listen queue for you and me). optional. did she stutter? no. πΈ
π SEE ALSO π
AnyEventAnyEvent::FCGI::Request
and lowkey important lore: this module is based on FCGI::Async and FCGI::EV. respect the ancestors. π«‘
π§ LICENSE π§
this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. go read perlartistic if you want the full tea. π
π AUTHOR π
Vitaly Kramskikh, <vkramskih@cpan.org> β absolute legend, gave us this whole module, we love her for it. π
ok that's the whole page bestie, go forth and build your non-blocking FastCGI server, you're gonna ate that π β¨
this masterpiece dropped as perl v5.36.0 on 2022-10-14, and it lives in AnyEvent::FCGI(3pm) β stay slaying, stay non-blocking, mwah ππ
π¦ where this page comes from
- ubuntu noble: libanyevent-fcgi-perl 0.04-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libanyevent-fcgi-perl 0.04-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libanyevent-fcgi-perl 0.04-3 Β· 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