hello,
I've a script that modify a value of an attribute in an xml file ,
the script modify the attribut but the problem is that the result is print in the shell
my script
and i can't verify if the modification are good because the output is in the shell and i've a big xml file
i've tried this
$price-> FILE print;it's not run
and this
print FILE $price;it's change nothing
thanks
I've a script that modify a value of an attribute in an xml file ,
the script modify the attribut but the problem is that the result is print in the shell
my script
Code:
#!/usr/bin/perl
use XML::Twig;
my $filename = './it2.xml';
open(FILE, '>', $filename) || die("impossible open $filename ");
my $t= XML::Twig->new(
twig_roots => { 'top' => \&its, },
twig_print_outside_roots => 1,
);
$t->parsefile( 'its.xml');
sub its
{ my( $t, $price)= @_;
my $currency= $price->{'att'}->{'bat'};
if( $currency eq 'Except')
{ $usd_price= $price->text;
my $euro_price= $usd_price ;
$price->set_text( $euro_price);
$price->set_att( VALUE => 'FINE');
}
$price->print;
}
and i can't verify if the modification are good because the output is in the shell and i've a big xml file
i've tried this
$price-> FILE print;it's not run
and this
print FILE $price;it's change nothing
thanks