Plack:...Server(3pm)

πŸ“¦
version 0.15 Β· 3 versions
, in fedora 43

πŸ’– 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 :port or host: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 the listen() queue size for creating listening sockets. if it's missing, a default of 10 is 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 from perl v5.42.0, dated 2025-07-25, under the manual name Plack:...Server(3pm) β€” no cap, go slay some HTTP πŸ’…βœ¨πŸŒΈ
πŸ“¦ where this page comes from