Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Is is possible to XML Simple with xml files that may have missing tags? I'm tempted to just use a shell call to xsltproc which handles this sort of issue, but would like to keep it all perl if possible.Can't call method "status" on unblessed reference at
use XML::Simple; use strict; my $xml = new XML::Simple(); $data = $xml->XMLin("file.xml", ForceArray => [qw( node internal )],Ke +yA ttr=> [qw( status )],); print Dumper($data); my $status=$data->status->{'state'}; if ($status eq "active"){ print "active" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Simple giving unblessed reference
by ikegami (Patriarch) on Dec 10, 2014 at 07:05 UTC | |
|
Re: XML::Simple giving unblessed reference
by jellisii2 (Hermit) on Dec 10, 2014 at 13:36 UTC |