Plack::Server - Standard interface for Plack implementations
package FooBarServer; sub new { my($class, %opt) = @_; ... return $self; } sub run { my($self, $app) = @_; # launch the server and run $app in the loop } # then from command line plackup -s +FooBarServer -a app.psgi
Plack::Server is an abstract interface (but not actually a base class) of Plack PSGI implementations. As long as they implement the methods defined as an Server unified interface, they do not need to inherit Plack::Server.
$server = FooBarServer->new(%args);
Creates a new implementation object. %args can take arbitrary parameters per implementations but common parameters are:
Port number the server listens to.
Address the server listens to. Set to undef to listen any interface.
$server->run($app);
Starts the server process and when a request comes in, run the PSGI application passed in $app in the loop.
$app
$server->register_service($app);
Optional interface if your server should run in parallel with other event loop, particularly AnyEvent. This is the same as run but doesn't run the main loop.
run
rackup
To install Plack, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack
CPAN shell
perl -MCPAN -e shell install Plack
For more information on module installation, please visit the detailed CPAN module installation guide.