mjoyce has asked for the wisdom of the Perl Monks concerning the following question:
I expected that all "item"s would be turned into arrays, but that doesn't happen when trying to build the "SoftwareMenu" which only contains other submenus. I get a "Not an ARRAY reference" error. If I add a "blank" item to the SoftwareMenu, the code works. Any help would be appreciated. An example of my XML:use XML::Simple qw(:strict); XMLin($menufile,forcearray=>['item','command','exec','menu'],keyattr=> +['name'],suppressempty=>undef);
<opt> <menu name="MainMenu"> <label> OPS Menu </label> <item type="command"> <label> EDM </label> <exec> <run> edmBeta </run> </exec> </item> <item type="submenu"> <name> SoftwareMenu </name> </item> </menu> <menu name="SoftwareMenu"> <label> Software Tools </label> <item type="submenu"> <name> IOCMenu </name> </item> </menu> </opt>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Simple help
by isotope (Deacon) on Mar 20, 2008 at 16:46 UTC | |
|
Re: XML::Simple help
by toolic (Bishop) on Mar 20, 2008 at 17:23 UTC |