Plack::...:WrapCGI(3)
π Plack::App::WrapCGI π
okay bestie, so this is a page from the User Contributed Perl Documentation and it's about Plack::App::WrapCGI β the little icon that Compiles a CGI script as PSGI application. yes that's the whole name. it literally does what it says on the tin and I'm obsessed π
β¨ NAME β¨
Plack::App::WrapCGI β Compiles a CGI script as PSGI application π¦
πΈ SYNOPSIS πΈ
the way you just... do this. simple. clean. no notes:
use Plack::App::WrapCGI;
my $app = Plack::App::WrapCGI->new(script => "/path/to/script.pl")->to_app;
# if you want to execute as a real CGI script
my $app = Plack::App::WrapCGI->new(script => "/path/to/script.rb", execute => 1)->to_app;
see that second one? that's the execute => 1 era. when you wanna run it as a real CGI script. periodt π
π DESCRIPTION π
so Plack::App::WrapCGI takes a CGI script and compiles it into a PSGI application, using CGI::Compile and CGI::Emulate::PSGI as the whole support system behind the scenes (they're doing the heavy lifting, we love them π«Ά), and then it just... runs it with any PSGI server, as a PSGI application. that's it. that's the vibe check and it passed β
also π β if you have a whole directory stuffed with a ton of CGI scripts and you wanna serve them the way Apache's mod_cgi does, you want Plack::App::CGIBin instead. different app, same energy. iykyk
π METHODS π
new
my $app = Plack::App::WrapCGI->new(%args);
creates a new PSGI application using the script you handed it. %args takes exactly two parameters and here they are, no gatekeeping:
scriptβ the path to a CGI-style program. this one is the required parameter, like you literally cannot skip it bestie, it's the whole point πexecuteβ an optional parameter. set it to a true value and this app will run the script with a CGI-stylefork/execmodel. and the fun part?? you can run programs written in other languages with this approach. iconic behavior honestly π
lowkey important: execute being optional means if you don't pass it, you're not getting the fork/exec treatment. don't be surprised later. fr fr π
π AUTHOR π
Tatsuhiko Miyagawa
(genius. legend. mother. ate and left no crumbs β¨)
π SEE ALSO π
Plack::App::CGIBin
and that's the whole page bestie!! this was Plack::App::WrapCGI(3) from the User Contributed Perl Documentation, and the footer said perl v5.42.3 dated 2026-10-18 β so yeah, this doc is from the future and it still slays ππ
π¦πΈβ¨ππ«Ά
π¦ 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