theguvnor has asked for the wisdom of the Perl Monks concerning the following question:
But, while I could make the pl2xml method work fine, I am unable to get it to convert the XML output back into a perl structure.
Here's a simplification of the code I'm using:
use XML::Dumper; my $xml; my %config = ('a key'=>'a value', 'another key'=>'another value'); my $dumper = XML::Dumper->new(); $xml = $dumper->pl2xml(\%config); print "xml output: ", $xml; my $config = $dumper->xml2pl($xml); die "Uh oh" unless defined $config; exit;
The above code prints out a snippet of xml just fine, but dies because the return from the call to xml2pl is undefined. I was under the impression it would return a reference to a perl data structure. Why does this method not reverse the process - I'm not even getting any indication of why it's failing!
Any help appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: XML::Dumper
by jeffa (Bishop) on Jan 20, 2002 at 23:54 UTC | |
by theguvnor (Chaplain) on Jan 21, 2002 at 00:45 UTC | |
by jeffa (Bishop) on Dec 09, 2002 at 16:04 UTC | |
|
(crazyinsomniac) Re: XML::Dumper
by crazyinsomniac (Prior) on Jan 21, 2002 at 03:14 UTC |