The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Server::Coro - A co-operative multithreaded server using Coro

SYNOPSIS

    use Coro;
    use base qw/Net::Server::Coro/;

    __PACKAGE__->new->run;

    sub process_request {
       ...
       cede;
       ...
    }

DESCRIPTION

Net::Server::Coro implements multithreaded server for the Net::Server architecture, using Coro and Coro::Socket to make all reads and writes non-blocking. Additionally, it supports non-blocking SSL negotiation.

METHODS

Most methods are inherited from Net::Server -- see it for further usage details.

make_coro_socket SOCKET

Takes an IO::Socket or Net::Server::Proto object, and converts it into a Net::Server::Proto::Coro object.

loop

The main loop uses starts a number of Coro coroutines:

  • One for each listening socket.

  • One for each active connection. Since these may respawn on a firlay frequent basis, "async_pool" in Coro is used to maintain a pool of coroutines.

  • The EV event loop.

DEPENDENCIES

Coro, EV, Net::Server

BUGS AND LIMITATIONS

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.