in reply to XML::Twig and closures.

I am not quite sure what you want to do here, but did you know that you "friend" (joking ;--) can generate a closure "on the fly"?

It goes simply like this:

my $self={}; XML::Twig->new( twig_handlers => { 'a/b' => sub { $self->my_method( @_ +); } ); ... sub my_method { my( $self, $t, $elt)= @_; ... }

Simon Cozens' Achieving Closure article has more details on closures, using XML::Twig as an example.

Does that help?

Replies are listed 'Best First'.
Re^2: XML::Twig and closures.
by absolut.todd (Monk) on Dec 17, 2007 at 01:22 UTC
    Ahhhhh, and the lightbulb turns on! Thank you, that is exactly what i was trying to achieve for my "friend".