Tree::...iteral(3pm)

πŸ“¦
version 0.05 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ Tree::XPathEngine::Literal ✨

okay bestie, welcome to the User Contributed Perl Documentation page for Tree::XPathEngine::Literal πŸ’– (that's a 3pm manpage, for the record β€” perl module, third-party, iykyk).


🌸 NAME 🌸

Tree::XPathEngine::Literal β€” Simple string values. That's it. That's the whole vibe. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

So in XPath-speak, a Literal is literally just what the rest of us call a string. No cap. It's a wrapper around a string so the XPath engine can tell "this is a string" apart from numbers and booleans. ✨


πŸ’… API πŸ’…

🌟 new($string)

Makes you a brand-new Literal object holding whatever you passed in as $string. Slay.

⚠️ Heads up though: " and ' get converted to " and ' respectively. That is not part of the XPath specification, but whoever wrote this considered it useful. πŸ’€

But listen β€” because of that little quirk, you have to go to extraordinary lengths in an XML template file (XSLT or whatever, doesn't matter) to actually make use of it:

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

Which produces a Literal of:

I'm feeling "sad"

Like… the gymnastics. The hoops. The way that whole thing is doing the most just to get some quotation marks. 😭 But it works. 🫢


🌈 value()

Also overloaded as stringification, and it simply returns the literal string value. No drama, no side quests. It just hands you the string back. πŸ‘‘


πŸ“ xpath_cmp($literal)

Returns the equivalent of perl's cmp operator, but against the given $literal. So you get that good good string-comparison energy, XPath style. ✨


πŸŽ€ Other Methods πŸŽ€

These ones are needed so the objects can be properly processed in various contexts. They're the behind-the-scenes girlies holding it all together. 🧚

  • as_string
  • as_xml
  • value
  • evaluate
  • xpath_to_boolean
  • xpath_to_literal
  • xpath_to_number
  • xpath_string_value

and that's the whole page, bestie!! πŸ’œ this one's rocking perl v5.36.0, dated 2022-11-20, and it's filed under Tree::...iteral(3pm) because apparently we couldn't fit the whole name in the footer. iconic behaviour, honestly. take care of her, mwah πŸ’‹πŸŒˆβ­

πŸ“¦ where this page comes from