Plack::...:PSGIBin(3)
π¦ Plack::App::PSGIBin β the Perl doc for the Perl girlies π
okay bestie, grab your boba, because this one is a Plack app that serves up .psgi files straight out of a directory like it's a little vending machine of web apps πβ¨ (it lives in the User Contributed Perl Documentation corner of the Plack::...:PSGIBin(3) manual, iykyk)
β¨ NAME β¨
Plack::App::PSGIBin β it runs .psgi files from a directory. that's it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
like, here's how you'd actually use it:
use Plack::App::PSGIBin;
use Plack::Builder;
my $app = Plack::App::PSGIBin->new(root => "/path/to/psgi/scripts")->to_app;
builder {
mount "/psgi" => $app;
};
# Or from the command line
plackup -MPlack::App::PSGIBin -e 'Plack::App::PSGIBin->new(root => "/path/psgi/scripts")->to_app'
no cap, copy that and go π
π DESCRIPTION π
so basically this application loads .psgi files β or actually, whichever filename extensions you're feeling, it does not gatekeep β from the root directory and runs it as a PSGI application. periodt. π₯
imagine you have a directory containing foo.psgi and bar.psgi. map this application to /app with Plack::App::URLMap, and boom, you can access them via the URL:
http://example.com/app/foo.psgi
http://example.com/app/bar.psgi
and that's how you load them π«
now for the glow-up tip π: you can rename the file to the one without the .psgi extension to make the URL look nicer (aesthetically pleasing URLs are the main character energy we deserve), or use URL rewriting tools like Plack::Middleware::Rewrite to do the same thing. either way, slay. β¨
π AUTHOR π
Tatsuhiko Miyagawa β the icon who made this π«Ά
π SEE ALSO π
Plack::App::CGIBinβ the sibling, the cousin, the family π
and that's the whole page, bestie! π§ it's from the User Contributed Perl Documentation, running perl v5.42.3, dated 2026-10-18, filed under Plack::...:PSGIBin(3). drink water, write your tests, and go be the main character of your own app π
β
π¦ 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