in reply to Re: XML::Twig newbie question
in thread XML::Twig newbie question
Another way would be to make the subroutine curried (that is expecting to get the parameters separately, not all at once):
foreach my $file (@files){ # set up the XML parser: my $twig= XML::Twig->new( twig_handlers => { topicref => topicref_processing($file), xref => topicref_processing($file) }, ); $twig->parsefile($file); $twig->purge; } sub topicref_processing { my ($file) = @_; return sub { my($twig, $topicref) = @_; my($atts) = $topicref->atts(); if($$atts{'keyref'}){ ### associate this keyref with $file } } }
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: XML::Twig newbie question
by Anonymous Monk on Sep 18, 2012 at 07:31 UTC | |
by Jenda (Abbot) on Sep 18, 2012 at 10:57 UTC | |
Re^3: XML::Twig newbie question
by slugger415 (Monk) on Sep 18, 2012 at 15:50 UTC | |
by Jenda (Abbot) on Sep 18, 2012 at 19:34 UTC |
In Section
Seekers of Perl Wisdom