cLive ;-) has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML module conflicts
by runrig (Abbot) on Mar 07, 2007 at 18:43 UTC | |
by cLive ;-) (Prior) on Mar 07, 2007 at 18:59 UTC | |
by runrig (Abbot) on Mar 07, 2007 at 19:13 UTC | |
by cLive ;-) (Prior) on Mar 07, 2007 at 23:46 UTC | |
|
Re: XML module conflicts
by grantm (Parson) on Mar 10, 2007 at 03:45 UTC | |
|
Re: XML module conflicts
by runrig (Abbot) on Mar 08, 2007 at 18:29 UTC |