XML(3pm)

πŸ“¦
version 0.1 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble

πŸ’– 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::XML does 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