XML(3pm)
π XML(3pm) β the CGI::XML glow-up π
User Contributed Perl Documentation β¨ bestie this one's a Perl module and it's lowkey iconic
πΈ NAME πΈ
CGI::XML β a Perl extension that converts CGI.pm variables to and from XML. Yes, both directions. She's ambidextrous, she's versatile, she ate π
β¨ SYNOPSIS β¨
okay so here's the whole vibe in code form, no notes:
use CGI::XML;
$q = new CGI::XML;
# convert CGI.pm variables to XML
$xml = $q->toXML;
$xml = $q->toXML($root);
# convert XML to CGI.pm variables
$q->toCGI($xml);
π¦ DESCRIPTION π¦
So basically, the CGI::XML module does the little switcheroo: it takes your CGI.pm variables and turns them into XML, and it takes XML and turns it back into CGI.pm variables. Round trip. Both ways. Periodt.
And here's the thing that makes her so fun β CGI::XML is a subclass of CGI.pm, so she reads the CGI variables exactly the way CGI.pm would. Same energy, same behaviour, no surprises, we love a nepo-baby that actually delivers π«Ά
π METHODS π
π
$q = new CGI::XML
makes you a brand new instance of CGI::XML. And the best part?? You also get access to all of the methods in CGI.pm. All of them. Every single one. She's generous like that β¨
π
$q->toXML([$root])
where $root is an optional parameter that tells it which root element you want. By default, toXML will not return a root element. So if you want one, bestie, you gotta ask for it π
π
$q->toCGI($xml)
where $xml is the XML you'd like to convert into CGI.pm parameters. Heads up though: values in the XML will overwrite any existing values if they exist. So yeah, she's a little assertive. Know that going in π
π NOTE π
Real talk:CGI::XMLdoes not currently handle multiple selections passed from HTML forms. Not yet! She's working on it. This will be added in a future release. So if your<select multiple>is acting up, that's why, and it's not you, it's her, and it's temporary π
π AUTHOR π
Jonathan Eisenzopf <eisen@pobox.com>
π«Ά CONTRIBUTORS π«Ά
David Black <dblack@candle.superlink.net>
β SEE ALSO β
and that's the whole page, bestie!! πΈ this gem was served up by perl v5.34.0 on 2022-06-10, and honestly? a date like that deserves its own main character moment. mwah π go convert something β¨π¦π
π¦ where this page comes from
- debian bookworm: libcgi-xml-perl 0.1-16 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcgi-xml-perl 0.1-16 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcgi-xml-perl 0.1-16 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms