92sai has asked for the wisdom of the Perl Monks concerning the following question:
part of xml fileuse XML::Twig; my $twig= XML::Twig->new( pretty_print => 'indented', twig_handlers => { jdk => sub{ $_->set_text( 'JDK 1.8.0_40' ) }, }, ); $twig->parsefile_inplace( 'nightly.xml', 'bak.*' ); $twig->flush;
if i use flush command it gives the desired output on cmd... if i use parsefile_inplace command it is emptying the nightly.xml... if i just use parsefile the original file is intact without changing the value i want to change.. My requirement is to edit the value and save it in the same file Thanks in advance.<jdk>JDK 1.7.0_40</jdk>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: modifying xml file and saving them in the same file using Perl and XML:Twig
by toolic (Bishop) on Apr 22, 2015 at 12:54 UTC | |
by choroba (Cardinal) on Apr 22, 2015 at 15:33 UTC |