1Net::Server::Coro(3) User Contributed Perl Documentation Net::Server::Coro(3)
2
3
4
6 Net::Server::Coro - A co-operative multithreaded server using Coro
7
9 use Coro;
10 use base qw/Net::Server::Coro/;
11
12 __PACKAGE__->new->run;
13
14 sub process_request {
15 ...
16 cede;
17 ...
18 }
19
21 Net::Server::Coro implements multithreaded server for the Net::Server
22 architecture, using Coro and Coro::Socket to make all reads and writes
23 non-blocking. Additionally, it supports non-blocking SSL negotiation.
24
26 Most methods are inherited from Net::Server -- see it for further usage
27 details.
28
29 new
30 Create new Net::Server::Coro object. It accepts these parameters (in
31 addition to Net::Server parameters):
32
33 server_cert
34 Path to the SSL certificate that the server should use. This can be
35 either relative or absolute path. Defaults to
36 certs/server-cert.pem
37
38 server_key
39 Path to the SSL certificate key that the server should use. This
40 can be either relative or absolute path. Defaults to
41 certs/server-key.pem
42
43 proto_object HOST, PORT, PROTO
44 Wraps socket creation, turning all socket types into
45 Net::Server::Proto::Coro objects.
46
47 loop
48 The main loop uses starts a number of Coro coroutines:
49
50 · One for each listening socket.
51
52 · One for each active connection. Since these may respawn on a
53 firlay frequent basis, "async_pool" in Coro is used to maintain a
54 pool of coroutines.
55
56 · An AnyEvent infinite wait, which equates to the "run the event
57 loop."
58
59 server_cert [PATH]
60 Gets or sets the path of the SSL certificate used by the server.
61
62 server_key [PATH]
63 Gets or sets the path of the SSL key file used by the server.
64
66 Coro, AnyEvent, Net::Server
67
69 The client filehandle, socket, and peer information all use
70 Coro::Specific in order to constrain their information to their
71 coroutine. Attempting to access them from a different coroutine will
72 yield possibly unexpected results.
73
74 Generally, all those of Coro. Please report any bugs or feature
75 requests specific to Net::Server::Coro to
76 "bug-net-server-coro@rt.cpan.org", or through the web interface at
77 <http://rt.cpan.org>.
78
80 Alex Vandiver "<alexmv@bestpractical.com>"; code originally from Audrey
81 Tang "<cpan@audreyt.org>"
82
84 Copyright 2006 by Audrey Tang <cpan@audreyt.org>
85
86 Copyright 2007-2008 by Best Practical Solutions
87
88 This software is released under the MIT license cited below.
89
90 The "MIT" License
91 Permission is hereby granted, free of charge, to any person obtaining a
92 copy of this software and associated documentation files (the
93 "Software"), to deal in the Software without restriction, including
94 without limitation the rights to use, copy, modify, merge, publish,
95 distribute, sublicense, and/or sell copies of the Software, and to
96 permit persons to whom the Software is furnished to do so, subject to
97 the following conditions:
98
99 The above copyright notice and this permission notice shall be included
100 in all copies or substantial portions of the Software.
101
102 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
103 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
104 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
105 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
106 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
107 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
108 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
109
110
111
112perl v5.30.1 2020-01-30 Net::Server::Coro(3)