Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

petdance (2468)

AOL IM: petdance (Add Buddy, Send Message)
Yahoo! ID: petdance (Add User, Send Message)

I'm Andy Lester, and I like to test stuff. I also write for the Perl Journal, and do tech edits on books. Sometimes I write code, too.

Journal of petdance (2468)

Tuesday March 18, 2003
10:15 AM

My new name and the joys of XML::Simple

[ #11087 ]
I've changed my name to "Andy HASH(0x865e440) Lester". Read gnat's journal entry to find out why.

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...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.