XML::Li...Literal(3)

πŸ’– XML::LibXML::Literal β€” the manual, but make it cute πŸ’–

okay bestie, welcome to the XML::LibXML::Literal(3) page β€” yes it's a section 3 man page, yes it lives in User Contributed Perl Documentation, and yes it's about to be the most fun you've ever had reading about strings. ✨


🌸 NAME 🌸

XML::LibXML::Literal β€” literally just simple string values. that's it. that's the whole vibe. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So when we're talking XPath terms, a Literal is what the rest of us call a string. no cap. same thing, fancier name, main character energy. πŸŽ€


✨ API ✨

πŸ’œ new($string)

Makes you a brand new Literal object holding whatever's in $string. 🫢

But here's the tea: " and ' get converted into " and ' respectively. Is that in the XPath spec? Nope. Not even a little. But the author thinks it's useful, and honestly? valid. 😌

⚠️ Heads up though β€” to actually use this inside an XML template file (XSLT, whatever else you're doing), you have to go to extraordinary lengths. Like, absurd amounts of effort. it's giving "why is it like this". 😭

Check it:

<xsl:value-of select="&quot;I'm feeling &amp;quot;sad&amp;quot;&quot;"/>

And that whole chaotic situation produces a Literal of:

I'm feeling "sad"

See?? iconic, unhinged, and correct all at once. πŸ‘‘

πŸ’œ value()

Also overloaded as stringification β€” so it just hands you back the literal string value. simple. clean. slay. ✨

πŸ’œ cmp($literal)

Returns the equivalent of perl's cmp operator, run against the $literal you passed in. comparison girlies, this one's for you. πŸ’…


and that's the whole page, bestie!! 🌈 no more sections, no hidden lore, we ate and left no crumbs. πŸ“

little sign-off moment: this was perl v5.42.2, dated 2026-05-25, and yeah β€” the footer says XML::Li...Literal(3) because even man pages get their name truncated sometimes. πŸ’€πŸ«Ά bye pookie!! πŸ§šπŸ’–

πŸ“¦ where this page comes from