Since my recent Element Express credit card processing post didn't turn up any information on existing Perl to interface with Element Express, I've done some checking and set about figuring out how to talk to them using XML::Simple. I'm just at the stage of working out how to generate the XML to submit to them so far, but it's coming together quite nicely. Aside from one little detail:
#!/usr/bin/perl use strict; use warnings; use XML::Simple qw(xml_in xml_out); my $req = { Foo => { Bar => 1, Baz => [ 2 ], }, }; print xml_out($req);
produces
<opt> <Foo Bar="1"> <Baz>2</Baz> </Foo> </opt>
which is just about what I expected... except where did the outer <opt>...</opt> come from and how do I get rid of it?

(Granted, it's possible that the <opt> doesn't matter and everything would work fine even with it there, but it's not present in any of Element Express's samples of writing the XML by hand with a series of print statements, so I'd prefer that it not be there. And also granted I could strip off the first and last lines to get rid of it, but that's ugly and just feels wrong. So I'd really prefer to find a way to get XML::Simple to let me specify the outermost container myself instead of wrapping everything in an <opt> for no apparent reason.)


In reply to <opt>-less XML::Simple by dsheroh

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.