Plack::Runner - plackup core
# Your bootstrap script use Plack::Runner; my $app = sub { ... }; my $runner = Plack::Runner->new; $runner->parse_options(@ARGV); $runner->run($app);
Plack::Runner is the core of plackup runner script. You can create your own frontend to run your application or framework, munge command line options and pass that to run method of this class.
run
run method does exactly the same thing as the plackup script does, but one notable addition is that you can pass a PSGI application code reference directly with --app option, rather than via .psgi file path or with -e switch. This would be useful if you want to make an installable PSGI application.
--app
.psgi
-e
Also, when -h or --help switch is passed, the usage text is automatically extracted from your own script using Pod::Usage.
-h
--help
Do not directly call this module from your .psgi, since that makes your PSGI application unnecessarily depend on plackup and won't run other backends like Plack::Handler::Apache2 or mod_psgi.
If you really want to make your .psgi runnable as a standalone script, you can do this:
# foo.psgi if (__FILE__ eq $0) { require Plack::Runner; Plack::Runner->run(@ARGV, $0); } # This should always come last my $app = sub { ... };
plackup
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.