satzbu has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks i want to replace xml tags using XML::Twig for that purpose i run a sample programme from cpan XML::Twig site but it cant run the programme i have an error please help me to fix this error in the same time Split XML chunk by chunk programme works fine this the code and error
use XML::Twig; my $t= XML::Twig->new(); $t->parse( '<d><title>title</title><para>p 1</para><para>p 2</para>< +/d>'); my $root= $t->root; $root->set_tag( 'html'); # change doc to html $title= $root->first_child( 'title'); # get the title $title->set_tag( 'h1'); # turn it into h1 my @para= $root->children( 'para'); # get the para children foreach my $para (@para) { $para->set_tag( 'p'); } # turn them into p $t->print; # output the document
ERROR
Can't locate object method "new" via package "XML::Twig" (perhaps you forgot to load "XML::Twig"?) at liststyles.pl line 2.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig Sample programme error
by Anonymous Monk on Jan 11, 2011 at 11:54 UTC |