I'm amused that Nat got bitten by the same type of bug that bit me a few years ago the first time I had to use XML::Simple. In my case, I was parsing invoices, and getting back an arrayref of lines. Problem was, a week after we went live, I got an invoice with only one line item, and XML::Simple handed back a scalar for the line. I had to modify the XML::Simple constructor to always pass back an array for <Invoice> and <LineItem> tags.
my $xs = new XML::Simple( forcearray=>['Invoice','LineItem'] );
# We always want an array of Invoice and LineItem records, even if there's only one.
This cautionary tale is one I always tell to anyone using XML::Simple...
My new name and the joys of XML::Simple 0 Comments More | Login | Reply /