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 the GET method. so don't come at it with a POST, 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 (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 🌟

  • AppConfig
  • AppConfig::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