1Plack::Handler(3) User Contributed Perl Documentation Plack::Handler(3)
2
3
4
6 Plack::Handler - Connects PSGI applications and Web servers
7
9 package Plack::Handler::AwesomeWebServer;
10 sub new {
11 my($class, %opt) = @_;
12 ...
13 return $self;
14 }
15
16 sub run {
17 my($self, $app) = @_;
18 # launch the AwesomeWebServer and run $app in the loop
19 }
20
21 # then from command line
22 plackup -s AwesomeWebServer -a app.psgi
23
25 Plack::Handler defines an adapter (connector) interface to adapt
26 plackup and Plack::Runner to various PSGI web servers, such as Apache2
27 for mod_perl and Standalone for HTTP::Server::PSGI.
28
29 It is an empty class, and as long as they implement the methods defined
30 as an Server adapter interface, they do not need to inherit
31 Plack::Handler.
32
33 If you write a new handler for existing web servers, I recommend you to
34 include the full name of the server module after Plack::Handler prefix,
35 like Plack::Handler::Net::Server::Coro if you write a handler for
36 Net::Server::Coro. That way you'll be using plackup command line option
37 like:
38
39 plackup -s Net::Server::Coro
40
41 that makes it easy to figure out which web server you're going to use.
42
44 new
45 $server = FooBarServer->new(%args);
46
47 Creates a new adapter object. %args can take arbitrary parameters
48 to configure server environments but common parameters are:
49
50 port Port number the server listens to.
51
52 host Address the server listens to. Set to undef to listen any
53 interface.
54
55 run
56 $server->run($app);
57
58 Starts the server process and when a request comes in, run the PSGI
59 application passed in $app in the loop.
60
61 register_service
62 $server->register_service($app);
63
64 Optional interface if your server should run in parallel with other
65 event loop, particularly AnyEvent. This is the same as "run" but
66 doesn't run the main loop.
67
69 rackup
70
71
72
73perl v5.12.3 2011-02-27 Plack::Handler(3)