in reply to XML::Simple and variable interpolation
I understand you've got your script working but I just wanted to point out a potential problem with this line:
my $config = XMLin();
Calling XMLin() with absolutely no parameters is a bit of a 'red flag'. In your case, you want the XML file to be found automatically, so leaving the first parameter undefined is OK; but you're expecting the <profile> elements to be 'folded' into a hash keyed on the contents of the 'name' attribute. Unfortunately, if config file is edited and there's only one <profile> element in it, things will go horribly wrong. I'd recommend:
my $config = XMLin(undef, keyattr => { profile => 'name'}, forcearray => [ 'profile' ], );
Read more here.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: XML::Simple and variable interpolation
by amonotod (Acolyte) on Oct 17, 2003 at 20:22 UTC | |
by grantm (Parson) on Oct 17, 2003 at 21:52 UTC |