Coro::Twiggy(3pm)
π Coro::Twiggy β the vibe β¨
okay so bestie, welcome to Coro::Twiggy (it lives in the User Contributed Perl Documentation section of the manual, section 3pm, iykyk) β it's the Coro interface for Twiggy, and honestly? she's serving. π«Ά
πΈ NAME πΈ
Coro::Twiggy β the Coro interface for Twiggy. that's it, that's the name, no notes. π
β¨ SYNOPSIS β¨
here's the whole mood, copied exactly because I do not play with code:
use Coro::Twiggy;
use Plack::Request;
use Coro::AnyEvent;
my $application = sub {
my ($env) = @_;
my $req = Plack::Request->new($env);
Coro::AnyEvent::sleep 10;
...
return [
200,
[ 'Content-Type' => 'text/html' ],
[ 'Twiggy response after 10 seconds' ]
]
};
my $server = Coro::Twiggy->new(host => '127.0.0.1', port => 8080);
$server->register_service( $application );
like. she sleeps for 10 seconds mid-request and STILL delivers. main character energy fr fr. ππ₯
π¦ DESCRIPTION π¦
so the server starts Your application inside an async in a Coro coroutine, and then it takes whatever your app gives back and uses that to respond to the client. simple as that, no cap. β¨
your Application has to return an ARRAYREF with these three things in it:
- the HTTP-code;
- an ARRAYREF that contains the headers for the response;
- an ARRAYREF that contains the body of the response.
π real talk: to stop the server, you destroy the server object. that's the move. no shutdown method, just let her go.
π METHODS π
π new
Constructor. Returns server. iconic behaviour honestly. π
Named arguments:
hostportserviceβ the PSGI application
π register_service
(Re)register the PSGI application. β¨
π important: until then, the event server will respond 503 Service Unavailable. so register her before you expect anything cute back, bestie.
π§ VCS π§
<https://github.com/unera/coro-twiggy>
go forth and star her, she deserves it. β
πΈ AUTHOR πΈ
Dmitry E. Oboukhov, <unera@debian.org> β thank you king, we appreciate you. π«Ά
π COPYRIGHT AND LICENSE π
Copyright (C) 2012 by Dmitry E. Oboukhov
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
so yeah β free software, same terms as Perl itself, Perl version 5.8.8 or any later version you happen to have. slay. π
and that's the whole page bestie!! π this gorgeous little doc shipped with perl v5.32.0 and was dated 2021-01-09 β so if you're reading this, hi from the past, she ate and left no crumbs. πβ¨ bye!! π¦
π¦ where this page comes from
- debian bookworm: libcoro-twiggy-perl 0.03-1.1
- debian trixie: libcoro-twiggy-perl 0.03-1.1
- ubuntu jammy: libcoro-twiggy-perl 0.03-1.1
- ubuntu noble: libcoro-twiggy-perl 0.03-1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms