This is more of a FYI than a question, but anyway...

I just spent the best part of a couple of hours trying to work out why this worked:

use strict; use warnings; use XML::Simple; my $x = XMLin('./test.xml');

yet this didn't

use strict; use warnings; use XML::Simple; use POE::Component::Jabber::XMPP; my $x = XMLin('./test.xml');

Turns out one the Jabber module loads POE::Filter::XML, which in turn loads XML::SAX

When this happens, XML::Simple defaults to the SAX parser, screwing up filename arguments.

The solution is to add:

$XML::Simple::PREFERRED_PARSER = 'XML::Parser';

to the script, but that feels clutzy.

I'm pondering on whether there's a better approach for the XML::Simple module, and would welcome input before I send an email to the module's owner. It doesn't seem right to me that a module's behaviour would change just by loading another module. Or am I just not being lazy enough? ;-) Thoughts?


In reply to XML module conflicts by cLive ;-)

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.