Plack:...Server(3pm)
π Plack::Handler::Net::Async::HTTP::Server π
okay bestie, buckle up, because we're looking at a page from the User Contributed Perl Documentation and it's literally the manual for Plack::Handler::Net::Async::HTTP::Server π¦ (that's the Plack:...Server(3pm) situation, iykyk)
β¨ NAME β¨
Plack::Handler::Net::Async::HTTP::Server β HTTP handler for Plack using Net::Async::HTTP::Server πΈ
π SYNOPSIS π
no cap, here's the whole vibe:
use Plack::Handler::Net::Async::HTTP::Server;
my $handler = Plack::Handler::Net::Async::HTTP::Server->new(
listen => [ ":8080" ],
);
sub psgi_app { ... }
$handler->run( \&psgi_app );
π DESCRIPTION π
so basically? this module lets Plack run a PSGI application as a standalone HTTP daemon under IO::Async, and it does that by using Net::Async::HTTP::Server. the way it just works π«Ά
plackup -s Net::Async::HTTP::Server --listen ":8080" application.psgi
internally this is implemented using Net::Async::HTTP::Server::PSGI, and any further info on environment etc. lives over there in that documentation. go read it, bestie, it's giving thorough π
and listen β if IO::Async::SSL is available, this handler supports accepting connections via https:
plackup -s Net::Async::HTTP::Server --ssl ...
or you can do it per-listen argument by appending :SSL, like this:
plackup -s Net::Async::HTTP::Server --listen ":8443:SSL" ...
any other options whose names start with ssl_ get passed on to the SSL listen method. yes queen, all of them π
π CONSTRUCTOR π
π§ new
$handler = Plack::Handler::Net::Async::HTTP::Server->new( %args );
returns a brand new instance of a Plack::Handler::Net::Async::HTTP::Server object β¨ it takes these named arguments, and every single one matters:
listen => ARRAY of STRINGβ a reference to an array holding listen string specifications. each string gives you a port number plus an optional hostname, written as:portorhost:port. πserver_ready => CODEβ a reference to code that gets invoked when the server is all set up and listening, ready to accept connections. it's invoked with a HASH reference containing these deets:
$server_ready->( {
host => HOST,
port => SERVICE,
server_software => NAME,
} )
socket => STRINGβ gives a UNIX socket path to listen on, instead of a TCP socket. choose your fighter π¦queuesize => INTβ optional. if you provide it, it sets thelisten()queue size for creating listening sockets. if it's missing, a default of10is used. periodt π
π₯ METHODS π₯
β run
$handler->run( $psgi_app );
creates the HTTP-listening socket or sockets, and runs the given PSGI application for received requests. that's it, that's the whole job, and it ate π
π SEE ALSO π
- Net::Async::HTTP::Server β serve HTTP with IO::Async
- Plack β Perl Superglue for Web frameworks and Web Servers (PSGI toolkit)
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> π
and that's a wrap, bestie!! this whole page is coming to you fromperl v5.42.0, dated2025-07-25, under the manual namePlack:...Server(3pm)β no cap, go slay some HTTP π β¨πΈ
π¦ where this page comes from
- fedora 43: perl-Net-Async-HTTP-Server 0.15-2.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms