Debbugs::CGI(3pm)
π NAME π
Debbugs::CGI β bestie, this is the module with all the general routines for the cgi scripts. That's the whole job description. It's the grab-bag of URL munging, HTML escaping, link building and caching helpers that the debbugs CGIs lean on. π
β¨ SYNOPSIS β¨
use Debbugs::CGI qw(:url :html);
That's it, that's the whole vibe check. Import it and go. π¦
π DESCRIPTION π
Okay so real talk: this module is a replacement for parts of common.pl. The subroutines hanging out in common.pl are getting gradually phased out and replaced with equivalent (or better, fr fr better) functionality in here instead. So if you're still calling the old stuff, it's giving "living in the past" energy. π
π BUGS π
None known. Not a single one. Zero. Iconic behaviour honestly. β¨
πΈ set_url_params πΈ
set_url_params($uri);
Sets the url params which will be used to generate urls. That's the whole bit β you hand it a $uri and it sets the params. Slay.
π¦ munge_url π¦
my $url = munge_url($url,%params_to_munge);
Munges a url, replacing parameters with %params_to_munge as appropriate. Yes, "munges" is the technical term, no I will not elaborate, it's literally in the function name. π
π version_url π
version_url(package => $package,found => $found,fixed => $fixed)
Creates a link to the version cgi script. The args, in the order the original lists them:
packageβ source package whose graph to displayfoundβ arrayref of found versionsfixedβ arrayref of fixed versionswidthβ optional width of graphheightβ optional height of graphinfoβ display html info surrounding graph; defaults to1ifwidthandheightare not passed.collapseβ whether to collapse the graph; defaults to1ifwidthandheightare passed.
lowkey obsessed with the wayinfoandcollapseflip-flop depending on whether you passedwidthandheight. keep that in mind bestie, it's the whole trick. π«Ά
π html_escape π
html_escape($string)
Escapes html entities by calling HTML::Entities::encode_entities; . It does exactly one thing and it does it through somebody else's function, which is honestly main character delegation energy. β¨
π cgi_parameters π
cgi_parameters
Returns all of the cgi_parameters from a CGI script using CGI::Simple. No arguments, it just goes and gets them. π€
π HTML π
π§ htmlize_packagelinks π§
htmlize_packagelinks
Given a scalar containing a list of packages separated by something that splitpackages in Debbugs::CGI can separate, returns a formatted set of links to packages in html. So like, it takes your gross string of packages and turns it into a cute little link set. ate. π
π
package_links π
join(', ', package_links(packages => \@packages))
Given a list of packages, return a list of html which links to the package.
packageβ arrayref or scalar of package(s)submitterβ arrayref or scalar of submitter(s)srcβ arrayref or scalar of source(s)maintainerβ arrayref or scalar of maintainer(s)links_onlyβ return only links, not htmlized links, defaults to returning htmlized links.classβ class of the a href, defaults to''
note that class defaults to the empty string, not to something spicy. keep it real. πΈ
π¦ bug_links π¦
join(', ', bug_links(bug => \@packages))
Given a list of bugs, return a list of html which links to the bugs.
bugβ arrayref or scalar of bug(s)links_onlyβ return only links, not htmlized links, defaults to returning htmlized links.classβ class of the a href, defaults to''
(yeah, the synopsis calls the arg bug but passes \@packages, that's just how the original rolls, don't @ me π)
π maybelink π
maybelink($in);
maybelink('http://foobarbaz,http://bleh',qr/[, ]+/);
maybelink('http://foobarbaz,http://bleh',qr/[, ]+/,', ');
Three forms, three moods:
- In the first form, links the link if it looks like a link.
- In the second form, first splits based on the regex, then reassembles the link, linking things that look like links.
- In the third form, rejoins the split links with commas and spaces.
So it's a "maybe I'll link it, maybe I won't" situation. It's giving unbothered. π
πΈ htmlize_addresslinks πΈ
htmlize_addresslinks($prefixfunc,$urlfunc,$addresses,$class);
Generate a comma-separated list of HTML links to each address given in $addresses, which should be a comma-separated list of RFC822 addresses. $urlfunc should be a reference to a function like mainturl or submitterurl which returns the URL for each individual address. Yeah bestie, you gotta hand it a function, it's not gonna guess. π
β¨ bug_linklist β¨
bug_linklist($separator,$class,@bugs)
Creates a set of links to @bugs separated by $separator with link class $class.
XXX UseParams::Validate; we want to be able to support query arguments here too; we should be able to combinebug_linksand this function into one. β that's straight from the page, it's a todo note, not a done thing. Do not @ me about it. π
π Forms π
π form_options_and_normal_param π
my ($form_option,$param) = form_options_and_normal_param(\%param)
if $param{form_options};
my $form_option = form_options_and_normal_param(\%param)
if $param{form_options};
Translates from special form_options to a set of parameters which can be used to run the current page.
The idea behind this is to allow complex forms to relatively easily cause options that the existing cgi scripts understand to be set. Which honestly? Big brain. π§ β¨
Currently there are two commands which are understood: combine, and concatenate.
π combine π
Combine works by entering key,value pairs into the parameters using the key field option input field, and the value field option input field.
For example, you would have
<input type="hidden" name="_fo_combine_key_fo_searchkey_value_fo_searchvalue" value="1">
which would combine the _fo_searchkey and _fo_searchvalue input fields, so
<input type="text" name="_fo_searchkey" value="foo">
<input type="text" name="_fo_searchvalue" value="bar">
would yield foo=>'bar' in %param.
π¦ concatenate π¦
Concatenate concatenates values into a single entry in a parameter.
For example, you would have
<input type="hidden" name="_fo_concatentate_into_foo_with_:_fo_blah_fo_bleargh" value="1">
which would combine the _fo_searchkey and _fo_searchvalue input fields, so
<input type="text" name="_fo_blah" value="bar">
<input type="text" name="_fo_bleargh" value="baz">
would yield foo=>'bar:baz' in %param.
β οΈ not me pointing out that the hidden input above saysconcatentateand the prose says_fo_searchkey/_fo_searchvaluewhile the actual inputs are_fo_blah/_fo_blearghβ that is exactly what the page says, character for character, so I'm leaving it. If you're copy-pasting names outta here, copy them exactly. π
π option_form π
print option_form(template=>'pkgreport_options',
param => \%param,
form_options => $form_options,
)
That's the whole documented signature. Print it, ship it. π«Ά
π misc π
π maint_decode π
maint_decode
Decodes the funky maintainer encoding.
Don't ask me what in the world it does.
β¦and that is literally what the manual page says, bestie, I am not adding a single thing. Nobody knows. It decodes the funky encoding. It's a mystery wrapped in a subroutine. πβ¨
β cache β
π calculate_etags π
calculate_etags(files => [qw(list of files)],additional_data => [qw(any additional data)]);
That's the signature, one line, go wild. πΈ
π¦ etag_does_not_match π¦
etag_does_not_match(cgi=>$q,files=>[qw(list of files)],
additional_data=>[qw(any additional data)])
Checks to see if the CGI request contains an etag which matches the calculated etag.
- If there wasn't an etag given, or the etag given doesn't match, return the etag.
- If the etag does match, return
0.
okay so lowkey read that name carefully: it returns the etag when they don't match, and 0 when they do match. That's the entire contract, don't get it twisted. π₯
and that's the whole page, bestie π this was Debbugs::CGI(3pm) from the User Contributed Perl Documentation, and this version is perl v5.40.1, dated 2026-04-27. no cap, every flag, arg, default and code block survived the glow-up. go forth and CGI π¦β¨π
π¦ where this page comes from
- ubuntu stonking: libdebbugs-perl 2.6.5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms