Fellow monks,

I have just stumbled upon a blog entry about a technology that I had never heard of before, but that is apparently being widely implemented in the JavaScript world (Rhino 1.6 has it, Firefox 1.5 has it, Flash ActionScript 3 will have it): E4X -- ECMAScript for XML -- Native XML for JavaScript.

* var order = <order><customer>. . .</customer> <item><price>5</price><qty>10</qty></item> <item level="rush"> <price>2.5</price> <qty>30</qty> </item> <item level="rush"> <price>1.5</price> <qty>50</qty> </item> </order>; * var items = order.item; // XMLList of item el'ts * var prices = order..price; * var urgentItems = order.item.(@level == "rush"); * var itemAttrs = order.item[0].@*;

Basically E4X allows you to work with (and even embed) XML into JavaScript in a very straightforward fashion. In fact, the whole approach (especially the XML-here-doc/interpolation facility) strikes me as very Perlish, but a quick googling and a super-search here turned up nothing for "e4x perl".

My question is: are there plans to support E4X in Perl (not necessarily as a core feature, but as a module, and only as far is it is syntactically compatible), and is there already something similar to it in the Perl world.?

code sample taken from Brendan Eich's presentation at XTech 05


In reply to E4X4Perl ? by Thilosophy

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.