IO::Lam...:Server(3)
πΈ NAME πΈ
okay so this is the IO::Lambda::HTTP::Server(3) page β filed under User Contributed Perl Documentation, bestie β and it's all about IO::Lambda::HTTP::Server, a simple httpd server. periodt. π
β¨ DESCRIPTION β¨
The module exports a single function http_server that accepts a callback and a socket, with optional parameters. The callback accepts a HTTP::Request object, and is expected to return either a HTTP::Response object or a lambda that in turn returns a HTTP::Response object. no cap. π¦
π SYNOPSIS π
use HTTP::Request;
use IO::Lambda qw(:all);
use IO::Lambda::HTTP qw(http_request);
use IO::Lambda::HTTP::Server;
my $server = http_server {
my $req = shift;
if ( $req->uri =~ /weather/) {
context( HTTP::Request-> new( GET => "http://www.google.com/?q=weather"));
return &http_request;
} else {
return HTTP::Response->new(200, 'OK', ['Content-Type' => 'text/plain'], "hello world");
}
} "localhost:80";
$server->start; # runs in 'background' now
π API π
π«Ά http_server &callback, $socket, [ %options ] π«Ά
Creates lambda that listens on $socket, that is either a IO::Socket::INET object or a string such as "localhost" or "127.0.0.1:9999". π
The callback accepts a HTTP::Request object, and is expected to return either a HTTP::Response object or a lambda that in turn returns a HTTP::Response object. fr fr. π
π Options π
timeout $integerβ connection timeout or a deadline.shutdownβ enter a graceful shutdown mode β stop accepting new connections, handle the running ones, and stop after all connections are served.
π₯ SEE ALSO π₯
IO::LambdaHTTP::RequestHTTP::Response
π AUTHOR π
Dmitry Karasik, <dmitry@karasik.eu.org>. π«Ά
that's the whole vibe, bestie β this page is from perl v5.42.2, dated 2026-02-15, and it's the IO::Lam...:Server(3) manual. mwah πβ¨
π¦ where this page comes from
- alpine 3.24: perl-io-lambda-doc 1.34-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms