1Plack::Runner(3)      User Contributed Perl Documentation     Plack::Runner(3)
2
3
4

NAME

6       Plack::Runner - plackup core
7

SYNOPSIS

9         # Your bootstrap script
10         use Plack::Runner;
11         my $app = sub { ... };
12
13         my $runner = Plack::Runner->new;
14         $runner->parse_options(@ARGV);
15         $runner->run($app);
16

DESCRIPTION

18       Plack::Runner is the core of plackup runner script. You can create your
19       own frontend to run your application or framework, munge command line
20       options and pass that to "run" method of this class.
21
22       "run" method does exactly the same thing as the plackup script does,
23       but one notable addition is that you can pass a PSGI application code
24       reference directly to the method, rather than via ".psgi" file path or
25       with "-e" switch. This would be useful if you want to make an
26       installable PSGI application.
27
28       Also, when "-h" or "--help" switch is passed, the usage text is
29       automatically extracted from your own script using Pod::Usage.
30

NOTES

32       Do not directly call this module from your ".psgi", since that makes
33       your PSGI application unnecessarily depend on plackup and won't run
34       other backends like Plack::Handler::Apache2 or mod_psgi.
35
36       If you really want to make your ".psgi" runnable as a standalone
37       script, you can do this:
38
39         my $app = sub { ... };
40
41         unless (caller) {
42             require Plack::Runner;
43             my $runner = Plack::Runner->new;
44             $runner->parse_options(@ARGV);
45             $runner->run($app);
46             exit 0;
47         }
48
49         return $app;
50
51       WARNING: this section used to recommend "if (__FILE__ eq $0)" but it's
52       known to be broken since Plack 0.9971, since $0 is now always set to
53       the .psgi file path even when you run it from plackup.
54

SEE ALSO

56       plackup
57
58
59
60perl v5.34.0                      2022-01-21                  Plack::Runner(3)
Impressum