What I can't figure out is, how to pass the name in $file to the event handler, or conversely, how to associate the found attribute back to the $file. I'm probably missing something obvious, but can't puzzle it out. Any suggestions would be greatly appreciated.
You're missing closures, examples in XML::Twig traversing tree and storing in an array, XML::Twig n00b, Tutorials: Closure on Closures
for my $file ( ... ){ my $filename = $file; my %filnameKeyref; my $topicref = sub { ... $filenameKeyref{ $filename }; return; }; my $twig= XML::Twig->new( ... => $topicref ); $twig->...; }
Although you ought to write that as
for my $file ( ... ){ my $complexAssociations = FooAssoc( $file ); WalkAndTalk( $complexAssociations ); }
In reply to Re: XML::Twig newbie question
by Anonymous Monk
in thread XML::Twig newbie question
by slugger415
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |