Plack::Runner(3)
β¨ NAME β¨
Plack::Runner β it's literally the core of plackup bestie π
πΈ SYNOPSIS πΈ
# Your bootstrap script
use Plack::Runner;
my $app = sub { ... };
my $runner = Plack::Runner->new;
$runner->parse_options(@ARGV);
$runner->run($app);
π DESCRIPTION π
Okay so Plack::Runner is the actual heart of the plackup runner script. Like, plackup is the fit but this is the personality, yk? π«Ά
You can build your own frontend to run your application or framework β munge up those command line options however you want and hand them straight to the run method of this class. Girlboss behaviour, honestly.
The run method does exactly the same thing as the plackup script does, fr fr β but there's one notable little addition that's lowkey iconic: you can pass a PSGI application code reference directly to the method, instead of going through a .psgi file path or using the -e switch. Bestie that is SO useful if you want to make an installable PSGI application. Obsessed. πβ¨
Also!! When the -h or --help switch gets passed, the usage text is automatically extracted from your own script using Pod::Usage. It just knows. Main character energy tbh. π
π NOTES π
Do NOT directly call this module from your.psgi, okay?? Because that makes your PSGI application unnecessarily depend onplackupand it won't run other backends likePlack::Handler::Apache2ormod_psgi. And we are not doing that to ourselves. π
If you really want to make your .psgi runnable as a standalone script though, 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 recommendif (__FILE__ eq $0)but it's known to be broken since Plack 0.9971, because$0is now always set to the.psgifile path even when you run it fromplackup. So likeβ¦ don't do that one bestie, it's giving deprecated-and-broken π
π¦ SEE ALSO π¦
plackupβ go say hi, it's the sibling π
k that's the whole page bestie, slay β¨ This was Plack::Runner(3) from the User Contributed Perl Documentation, running on perl v5.42.3, dated 2026-10-18 β mwah, no cap, periodt. π
π
π¦ where this page comes from
- fedora 43: perl-Plack 1.0055-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-Plack 1.0055-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms