NAME
plackup - Run PSGI application with Plack servers
SYNOPSIS
# read your app from app.psgi file
plackup
# 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 127.0.0.1 test.psgi
DESCRIPTION
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 Plack::Loader for the authorative list.
plackup
assumes you have an app.psgi
script in your current directory, that would look like:
#!/usr/bin/perl
use MyApp;
my $app = MyApp->new;
my $handler = sub { $app->run_psgi(@_) };
The last statement of app.psgi
should be a code reference that is a PSGI application.
ARGUMENTS
- .psgi
-
plackup --host 127.0.0.1 --port 9090 /path/to/app.psgi
The first non-option argument is used as a
.psgi
file path. You can also set this path with-a
or--app
option. If omitted, the default file path isapp.psgi
in the current directory.
OPTIONS
- -a, --app
-
--app
option allows you to locate a.psgi
script with a different name in a different path. This can also be set as a non-option argument. (See above) - -e
-
Evaluate the given perl code as a PSGI app, much like perl's
-e
option. - -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.
- -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 based.
- -s, --server
-
Select a specific implementation to run on using the
PLACK_SERVER
environment variable or use the-s
or--server
flag which will be prefered over the environment variable if present. - -I
-
Specify perl library include path, like
perl
's -I option. - -M
-
Specify modules to load before loading the app code.
- -E, --env
-
Specify the environment option (default is
development
). If it's set todevelopment
, following middleware is enabled by default: AccessLog, StackTrace. - -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
lib
directory and the base directory where .psgi file is located. Use-R
if you want to watch other directories. - -R, --Reload
-
-R
option allows you to specify the path to watch file updates separated by comma (,
).plackup -R /path/to/project/lib,/path/to/project/templates
- -l, --loader
-
Specify the server loading subclass that implements how to run the server. Available options are Plack::Loader (default), Restarter (automatically set when
-r
or-R
is used) and Shotgun.
Other options that starts with --
are passed through to the backend server. See each Plack::Server backend documentations to see which options are available.