GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Plack::Runner(3) User Contributed Perl Documentation Plack::Runner(3)

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" 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 to the method, rather than via ".psgi" file path or with "-e" switch. This would be useful if you want to make an installable PSGI application.

Also, when "-h" or "--help" switch is passed, the usage text is automatically extracted from your own script using Pod::Usage.

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:

  my $app = sub { ... };

  unless (caller) {
      require Plack::Runner;
      my $runner = Plack::Runner->new;
      $runner->parse_options(@ARGV);
      $runner->run($app);
      exit 0;
  }

  return $app;

WARNING: this section used to recommend "if (__FILE__ eq $0)" but it's known to be broken since Plack 0.9971, since $0 is now always set to the .psgi file path even when you run it from plackup.

plackup
2020-11-30 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.