I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2011-11-29 05:38:28.491617-08 by mirod in response to 13561
Re: Pass a param to the callback?
You can pass parameters by using a closure:
my $p=1; my $twig= XML::Twig->new( twig_handlers => { foo => sub { foo( @_, $p); } }) ->parsefile( "my.xml"); sub foo { my( $twig, $elt, $param)= @_; ... }
Simon Cozen's Achieving Closure has a good description of what a closure is, including an example with XML::Twig.
Direct Responses: 13563 | Write a response