Hi! Why do I get my string two times in the output?
#!/usr/bin/perl
use warnings;
use strict;
use XML::Twig;
my $string = '<cd_catalogue><title>Hello, World!</title></cd_catalogue>';
my $t= XML::Twig->new( twig_handlers => { cd_catalogue => \&cd_catalogue, },
pretty_print => 'indented',
);
$t->parse( $string );
sub cd_catalogue {
my( $t, $cd_catalogue ) = @_;
$cd_catalogue->flush;
}
# Output:
#<cd_catalogue>
# <title>Hello, World!</title>
#</cd_catalogue>
#<cd_catalogue>
# <title>Hello, World!</title>
#</cd_catalogue>