shree has asked for the wisdom of the Perl Monks concerning the following question:
I have a Perl program to parse the xml file,
Here I have declared the final arrayref $ups_able_info as global.
Instead of this I want to make it local to the sub parsexml() and pass the same to the twig handle 'parse_table_info'.
If I try to pass the arryref to the twig handle getting the ERROR: 'Global symbol "$ups_table_info" requires explicit package'.
Can any one help me on this
my ($ups_able_info) = ([]); &parseXml($xmlfile); sub parseXml{ my $twig1 = new XML::Twig( twig_handlers => { 'ups:TABLE_INFO/ups:fiel +d' => \&parse_table_info} ); } ### twig handler to parse columns. sub parse_table_info { my( $twig, $table_info)= @_; my $table_column = {}; $table_column->{$table_info->first_child_text('ups:tag')} = $ +table_info->first_child_text('ups:ui_name'); push(@{$ups_table_info}, $table_column); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Passing parameters for XML::twig handler
by toolic (Bishop) on Apr 26, 2011 at 12:33 UTC | |
Re: Passing parameters for XML::twig handler
by mirod (Canon) on Apr 27, 2011 at 08:27 UTC | |
by Anonymous Monk on Apr 19, 2017 at 20:31 UTC |
Back to
Seekers of Perl Wisdom