note
ikegami
<p>Could it be that you're suppose to use <code>twig_handlers</code> instead of <code>twig_roots</code>, since you don't want <code>body</code> to become a root node? The example from the module's documentation is: (irrelevant details omitted)</p>
<code>
my $twig=XML::Twig->new(
twig_handlers => {
title => sub { $_->set_gi('h2') }, # Change title tags to h2.
para => sub { $_->set_gi('p') }, # Change para to p.
hidden => sub { $_->delete; }, # Remove hidden elements.
list => \&my_list_process, # Process list elements.
},
pretty_print => 'indented', # Output will be nicely formatted.
);
</code>
430860
430868