Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: CX or System

by jeffa (Chancellor)
on Apr 04, 2012 at 21:13 UTC ( #963530=note: print w/ replies, xml ) Need Help??


in reply to CX or System

There are several CPAN modules available right now that will parse XML for you into a Perl data structure, such as XML::Simple. While your approach works for your needs, consider "doing it the right way" by parsing the XML file into a data structure and pull the proper piece of data out, all within the context of your code, not your code and several other forked processes (cut, grep, etc.).

# the following is untested use strict; use warnings; use XML::Simple; use Data::Dumper; my $xml = XMLin( '/opt/SecureSphere/etc/bootstrap.xml' ); my $db = $xml->{path}{to}{db}; print Dumper $db; my $pass = `password_decode $db`; print "$pass\n";


jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)


Comment on Re: CX or System
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://963530]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2014-10-22 07:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (114 votes), past polls