Syntactic Confectionery Delight | |
PerlMonks |
Re: XML::Simple helpby isotope (Deacon) |
on Mar 20, 2008 at 16:46 UTC ( [id://675251]=note: print w/replies, xml ) | Need Help?? |
Update: Ah, I see I've misunderstood your question. For future reference, could you use Data::Dumper to make your explanation a lot more clear? In my words, the problem you have is that the single item element in your Software Menu is not being forced into an array, despite the ForceArray setting in XMLin(). I don't know the answer to that question. Update 2: I believe it's your setting for keyattr that's giving you trouble. If you change it to keyattr => { menu => 'name' }, you will get an arrayref in SoftwareMenu->{item}. Note that you'll have to do more legwork to get the item's name attribute folded, as adding it to keyattr (item => 'name') will require that you either disable XML::Simple's STRICT MODE, or ensure every item has a name attribute: Note: "XMLin()" will generate a warning (or a fatal error in "STRICT MODE") if this syntax is used and an element which does not have the specified key attribute is encountered (eg: a 'package' element without an 'id' attribute, to use the example above). Warnings will only be generated if -w is in force. --isotope
In Section
Seekers of Perl Wisdom
|
|