Net::S...r::Coro(3pm)
πΈ NAME πΈ
Net::Server::Coro β a co-operative multithreaded server using Coro π
okay so welcome to the Net::S...r::Coro(3pm) page, bestie!! it's a User Contributed Perl Documentation joint, and it's literally about spinning up a co-operative multithreaded server. yes we're doing coroutines. yes it's cute. let's go π¦
β¨ SYNOPSIS β¨
use Coro;
use base qw/Net::Server::Coro/;
__PACKAGE__->new->run;
sub process_request {
...
cede;
...
}
like, that's it. that's the whole vibe. you use Coro, you inherit from Net::Server::Coro, you call new->run, and inside your process_request you just cede whenever you wanna hand the baton to somebody else πβοΈπ¨
π DESCRIPTION π
Net::Server::Coro implements a multithreaded server for the Net::Server architecture, using Coro and Coro::Socket to make all reads and writes non-blocking. no cap. additionally, it supports non-blocking SSL negotiation. iconic behavior honestly π
π METHODS π
most of the methods are just inherited from Net::Server β go read that page for the full usage tea. but here's what's special to this one:
π new
creates a new Net::Server::Coro object. it accepts these parameters (on top of all the Net::Server parameters you already know and love):
server_certβ path to the SSL certificate the server should use. can be a relative path or an absolute path, whichever you vibe with. defaults tocerts/server-cert.pemπΈserver_keyβ path to the SSL certificate key the server should use. again, relative or absolute, dealer's choice. defaults tocerts/server-key.pemπ
π§ proto_object HOST, PORT, PROTO
wraps up socket creation and turns every socket type into a Net::Server::Proto::Coro object. glow-up for sockets, periodt β¨
π loop
the main loop kicks off a bunch of Coro coroutines:
- one for each listening socket π
- one for each active connection. and because these may respawn on a firlay frequent basis,
async_poolin Coro is used to maintain a pool of coroutines πβοΈ - an AnyEvent infinite wait, which equates to the "run the event loop." βΎοΈ
π server_cert [PATH]
gets or sets the path of the SSL certificate used by the server.
π server_key [PATH]
gets or sets the path of the SSL key file used by the server.
π DEPENDENCIES π
Coro, AnyEvent, Net::Server
π BUGS AND LIMITATIONS π
the client filehandle, socket, and peer information all use Coro::Specific in order to constrain their info to their own coroutine. so if you try to access them from a different coroutine, you will get possibly unexpected results. that's the warning, bestie, don't do it π
generally, all those of Coro. please report any bugs or feature requests specific to Net::Server::Coro to bug-net-server-coro@rt.cpan.org, or through the web interface at <http://rt.cpan.org>. π«Ά
π«Ά AUTHORS π«Ά
Alex Vandiver <alexmv@bestpractical.com>; code originally from Audrey Tang <cpan@audreyt.org> π
β COPYRIGHT β
Copyright 2006 by Audrey Tang <cpan@audreyt.org>
Copyright 2007-2008 by Best Practical Solutions
this software is released under the MIT license cited below. π
The "MIT" License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
okay that's the whole page, you ate it up fr fr π this was perl v5.26.2, dated 2018-08-20, and it's giving Net::S...r::Coro(3pm) β slay, mwah, bye bestie πβ¨π¦
π¦ where this page comes from
- debian bookworm: libnet-server-coro-perl 1.3-2 Β· MIT
- debian trixie: libnet-server-coro-perl 1.3-2 Β· MIT
- ubuntu jammy: libnet-server-coro-perl 1.3-2 Β· MIT
- ubuntu noble: libnet-server-coro-perl 1.3-2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms