Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
executable file 139 lines (88 sloc) 3.4 KB
use strict;
use lib "lib";
use Plack::Runner;
my $runner = Plack::Runner->new;
=head1 NAME
plackup - Run PSGI application with Plack servers
# read your app from app.psgi file
# can be passed as an ARGV[0] (or with -a option)
plackup hello.psgi
# Switch server implementation with --server (or -s)
plackup --server Coro --port 9090 --host test.psgi
plackup is a command line utility to run PSGI application from the command line.
plackup automatically figures out the environment it is run in, and
runs your application in that environment. FastCGI, CGI, AnyEvent and
others can all be detected. See L<Plack::Loader> for the authorative
C<plackup> assumes you have an C<app.psgi> script in your current
directory, that would look like:
use MyApp;
my $app = MyApp->new;
my $handler = sub { $app->run_psgi(@_) };
The last statement of C<app.psgi> should be a code reference that is a
PSGI application.
=over 4
=item .psgi
plackup --host --port 9090 /path/to/app.psgi
The first non-option argument is used as a C<.psgi> file path. You can
also set this path with C<-a> or C<--app> option. If omitted, the
default file path is C<app.psgi> in the current directory.
=head1 OPTIONS
=over 4
=item -a, --app
C<--app> option allows you to locate a C<.psgi> script with a
different name in a different path. This can also be set as a
non-option argument. (See above)
=item -e
Evaluate the given perl code as a PSGI app, much like perl's C<-e>
=item -o, --host
The interface a TCP based server daemon binds to. Defauts to undef,
which lets most server backends bind the any (*) interface. This
opeion doesn't mean anything if the server is not TCP based.
=item -p, --port
The port number a TCP based server daemon listens on. Defaults to
5000. This option doesn't mean anything if the server is not TCP
=item -s, --server
Select a specific implementation to run on using the C<PLACK_SERVER>
environment variable or use the C<-s> or C<--server> flag which will
be prefered over the environment variable if present.
=item -I
Specify perl library include path, like C<perl>'s -I option.
=item -M
Specify modules to load before loading the app code.
=item -E, --env
Specify the environment option (default is C<development>). If it's
set to C<development>, following middleware is enabled by default:
L<AccessLog>, L<StackTrace>.
=item -r, --reload
Make plackup to watch updates from your development directory and
restarts the server whenever a file is updated. This option by default
watches the C<lib> directory and the base directory where I<.psgi>
file is located. Use C<-R> if you want to watch other directories.
=item -R, --Reload
C<-R> option allows you to specify the path to watch file updates
separated by comma (C<,>).
plackup -R /path/to/project/lib,/path/to/project/templates
=item -l, --loader
Specify the server loading subclass that implements how to run the
server. Available options are I<Plack::Loader> (default), I<Restarter>
(automatically set when C<-r> or C<-R> is used) and I<Shotgun>.
Other options that starts with C<--> are passed through to the backend
server. See each Plack::Server backend documentations to see which
options are available.
=head1 SEE ALSO
L<Plack::Runner> L<Plack::Loader>
Jump to Line
Something went wrong with that request. Please try again.