Net::S...r::Coro(3pm)

πŸ“¦
version 1.3 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

🌸 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 to certs/server-cert.pem 🌸
  • server_key β€” path to the SSL certificate key the server should use. again, relative or absolute, dealer's choice. defaults to certs/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_pool in 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 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