Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: XML::Twig - provide additional parameters to twig_roots handlers

by Jenda (Abbot)
on Oct 03, 2012 at 19:00 UTC ( #997120=note: print w/replies, xml ) Need Help??


in reply to Re^4: XML::Twig - provide additional parameters to twig_roots handlers
in thread XML::Twig - provide additional parameters to twig_roots handlers

The problem with adding own fields into the hashref is that you might unintentionally step over something. Or have an update to the module break your script, because the module starts using some key you added. That's why I specifically reserved $parser->{pad} as a place for user defined data attached to a parser and $parser->{parameters} as a place where you can find the additional parameter passed to the $parser->parse() call in XML::Rules.

Agreed on the closure being the cleanest way.

Jenda
Enoch was right!
Enjoy the last years of Rome.