use warnings;
use strict;
use XML::Twig;
my $children = 10000;
my $found;
my $xmlStr = <
@{["1\n" x $children]}
XML
my $twig = XML::Twig->new(
keep_encoding => 1,
twig_handlers => {'lemma' => \&ProcessLemma}
);
$twig->parse($xmlStr);
print "Expected $children, found $found\n";
sub ProcessLemma {
my ($XmlTwig, $XmlLemma) = @_;
++$found;
$XmlLemma->purge;
return 1;
}
####
Expected 10000, found 10000