From the docs for XML::Twig:
end_tag_handlers
A hash { expression => \&handler}. Sets element handlers that are called when the element is closed (at the end of the XML::Parser End handler). The handlers are called with 2 params: the twig and the tag of the element.
twig_handlers
are called when an element is completely parsed, so why have this redundant option? There is only one use forend_tag_handlers
: when using thetwig_roots
option, to trigger a handler for an element outside the roots.
You're setting up an end handler for your auto
element, which is the root. And you're only using twig_roots
for apps
. So the end handler will never be called.
You should install your handler using twig_handlers
instead.
So try this:
my $twig = XML::Twig->new(
start_tag_handlers =>
{ 'auto' => \&loading
},
twig_handlers =>
{ 'apps/title' => \&kicks,
'apps/logs' => \&bye,
'auto' => \&finish
},
twig_roots =>
{ 'apps' => \&app
},
);
friedo
2009-09-21 02:38:33