euz has asked for the wisdom of the Perl Monks concerning the following question:
Here s my problem (which I can't solve since a long long tiiiime), I can live with it but I was wondering if it could be solved :)
1/ I have a perl script reading a XML file :2/ I read it this way :<conf name="snoopdogg" serial="1" target="172.16.1.3"> <services> <service name="cpu"> <plugins> <plugin name="cpu" target="172.16.1.3" schedule="60"> <probes> <probe name="load1"> <warn value="4" operator=">"/> <crit value="10" operator=">"/> </probe> (...)
The problem is the following : I want to access a probe's warn value, to do so I have to :my $configuration = $xml->XMLin( $conf, GroupTags => { services => 'service', plugins => 'plugin', probes => 'probe' }, ForceArray => [ qw(service plugin probe) ], KeyAttr => { 'service' => 'name', 'plugin' => 'name', 'probe' => 'name' }, KeepRoot => 0 );
What I would like is to access the value this way :my $warn = $configuration->{snoopdogg}{services}{cpu}{plugins}{cpu}{pr +obes}{load1}{warn}{value};
Is there a way with XML::Simple to achieve something likemy $warn = $configuration->{snoopdogg}{cpu}{cpu}{load1}{warn}{value};
Thank you very much ! :)GroupTags => { services => 'service' => name }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about XML::Simple
by Jenda (Abbot) on Mar 11, 2012 at 15:15 UTC | |
|
Re: Question about XML::Simple
by kcott (Archbishop) on Mar 11, 2012 at 15:02 UTC | |
|
Re: Question about XML::Simple
by euz (Initiate) on Mar 11, 2012 at 16:23 UTC | |
|
Re: Question about XML::Simple
by repellent (Priest) on Mar 11, 2012 at 21:37 UTC |