Plack::...ler::CGI(3)

πŸŽ€ Plack::Handler::CGI πŸŽ€

okay bestie, welcome to the manual page for Plack::Handler::CGI β€” that's the CGI handler for Plack, it lives in section 3 of the User Contributed Perl Documentation, and honestly? it's giving "small module, big main character energy." pull up a chair, we're doing this πŸ’–


✨ NAME ✨

Plack::Handler::CGI β€” CGI handler for Plack, fr fr. that's the whole name, that's the whole vibe πŸ¦‹


🌸 SYNOPSIS 🌸

so you wanna run a PSGI application as a CGI script? periodt. literally just rename your .psgi to .cgi and swap out the shebang line like this:

#!/usr/bin/env plackup
# rest of the file can be the same as other .psgi file

yep that's it, the rest of the file stays exactly the same as any other .psgi file. slay ✨

orrr, alternative route, you can make a .cgi file that contains something like this instead:

#!/usr/bin/perl
use Plack::Loader;
my $app = Plack::Util::load_psgi("/path/to/app.psgi");
Plack::Loader->auto->run($app);

this one will auto-recognize the CGI environment variable to load this class. it just knows. iykyk πŸ’…

and if you really wanna explicitly load the CGI handler β€” like, no auto-magic, you're doing it by hand β€” you can! for instance you might do this when you want to embed a PSGI application server built into a CGI-compatible perl-based web server:

use Plack::Handler::CGI;
Plack::Handler::CGI->new->run($app);

iconic behavior honestly πŸ‘‘


πŸ’œ DESCRIPTION πŸ’œ

okay so, real talk: this is a handler module to run any PSGI application as a CGI script. that's its whole job and it does it beautifully. no notes. 🫢


🌈 UTILITY METHODS 🌈

⭐ setup_env()

my $env = Plack::Handler::CGI->setup_env();
my $env = Plack::Handler::CGI->setup_env(\%override_env);

this one sets up the PSGI environment hash for a CGI request, pulling from %ENV, and then hands it right back to you.

and get this β€” you can pass in a hashref of key/value pairs to override the defaults if that's what you wanna do. your request, your rules, bestie πŸ’–


πŸ‘€ SEE ALSO πŸ‘€

  • Plack β€” yeah, the whole parent ecosystem, go say hi πŸ¦‹

lowkey reminder: the descriptions above are the whole story β€” nothing extra, nothing invented, just the facts with a glow-up πŸ’…

and that's a wrap! this page came to you from perl v5.42.3, dated 2026-10-18, filed under Plack::...ler::CGI(3) in the User Contributed Perl Documentation. mwah, bye bestie, go run some CGI πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from