Sure, my example is easily done using XML::LibXML, but it'd take a lot more code. This is similar to the fact that regular expressions in other languages are generally implemented as add-in libraries, and have the same capabilites as perl's regexes, but are a lot more cumbersome to use.

Also, if this were implemented as a native type, I have a gut feeling that it'd fit naturally into other expressions in a way that would be unnatural or impossible with the library approach.

For example, I'd bet Storable would be able to persist an xmlnode scalar to disk, and read it back in, in a way that looks just like persisting any other datatype. This is something that you just can't do with XML::LibXML without going through a complete deparse/reparse cycle, and the maintainer of XML::LibXML is pretty adamant about keeping it that way.

There would probably also be more natural fits with existing perl keywords, like grep/map/sort/foreach, which are cumbersome when you need to use a libraries methods to work with xml.

That's my hope, at least.

Doug.

PS: yeah, I thought qx was already in use, but you get the idea


In reply to Re^3: xQuery functionality in Perl? by DougWebb
in thread xQuery functionality in Perl? by DougWebb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.