AppConfig::CGI(3)
π AppConfig::CGI β the perl manual, but make it make sense π
okay bestie, so this is a page from the User Contributed Perl Documentation section, and it's literally called AppConfig::CGI(3). sit down, grab a lil snack π, and let's get into it.
β¨ NAME β¨
AppConfig::CGI β a Perl5 module for processing CGI script parameters. that's it, that's the whole vibe. nosy little module that takes what the browser sent you and hands it over to your config. π
πΈ SYNOPSIS πΈ
use AppConfig::CGI;
my $state = AppConfig::State->new(\%cfg);
my $cgi = AppConfig::CGI->new($state);
$cgi->parse($cgi_query);
$cgi->parse(); # looks for CGI query in environment
look at that. two lines to create it, one line to parse. iconic behaviour, no notes. π
π¦ OVERVIEW π¦
so AppConfig::CGI is a Perl5 module that implements a CGI interface to AppConfig. what does that mean? it means it goes and looks at the QUERY_STRING environment variable β or at a string you literally hand it as a parameter β and that string represents the extra parameters passed to a CGI query. π
then it uses that to update the variable values in an AppConfig::State object accordingly. so like, the state gets refreshed with whatever came in through the query, iykyk.
also important: AppConfig::CGI is distributed as part of the AppConfig bundle. it does not arrive alone, it comes with the whole friend group. π«Ά
π DESCRIPTION π
π§ USING THE AppConfig::CGI MODULE π§
to import and use the AppConfig::CGI module, this exact line should appear in your Perl script:
use AppConfig::CGI;
and here's the cute part β AppConfig::CGI is used automatically if you use the AppConfig module and create an AppConfig::CGI object through the cgi() method. so sometimes it just shows up for you. main character energy fr fr. β¨
AppConfig::CGI is implemented using object-oriented methods. a new AppConfig::CGI object is created and initialised using the new() method, and that returns a reference to a shiny new AppConfig::CGI object. you should pass in a reference to an AppConfig::State object as the first parameter, like so:
my $state = AppConfig::State->new();
my $cgi = AppConfig::CGI->new($state);
this will create and return a reference to a new AppConfig::CGI object. slay. π
π PARSING CGI QUERIES π
the parse() method is what you use to parse a CGI query β either one you specify explicitly, or one that's automatically extracted from the "QUERY_STRING" CGI environment variable. π
β οΈ heads up bestie: this currently limits the module to only supporting theGETmethod. so don't come at it with aPOST, it's not that girl (yet).
see AppConfig for the deets on using the AppConfig::CGI module via the cgi() method. π₯
π AUTHOR π
Andy Wardley, <abw@wardley.org<gt>
(that's literally what it says, angle brackets and all β we don't fix, we preserve π)
β COPYRIGHT β
Copyright (C) 1997-2007 Andy Wardley. All Rights Reserved.
Copyright (C) 1997,1998 Canon Research Centre Europe Ltd.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. free as in go off, bestie. ποΈ
π SEE ALSO π
AppConfigAppConfig::State
go read those too, they're the supporting cast and they ate. πΈ
okay that's the whole page!! π this one shipped as perl v5.42.0, dated 2015-04-14 β an elder icon but still serving looks. mwah, go parse something cute ππ¦π
π¦ where this page comes from
- opensuse-leap 16.0: perl-AppConfig 1.71-bp160.1.12 Β· Artistic-1.0 or GPL-1.0+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms