HTML::Pullparser error
am 04.04.2006 11:15:11 von Randall S BensonI am currently writing a benchmark tester for a web application.
I send the first command, then gather the results, on the third time
around I parse the results to build the arguments for the next command.
sub parseQuerySchedule()
{
my $wcontent = shift;
my @FORM_TAGS = qw(input);
my $names;
my $string = "";
my $found = 0;
if (!defined($wcontent)){return $string;}
# print "$wcontent\n";
my $p = HTML::PullParser->new(
$wcontent,
start => 'tag, attr',
end => 'tag',
text => '@{text}',
report_tags => \@FORM_TAGS,
)
|| die "$!";
while ( defined( my $t = $p->get_token ) )
{
if ( $t->[0] eq "input" )
{
$names = $t->[1];
# print "the keys... ", sort keys %$names, "...\n";
if ( defined( $names ) )
{
if ( $names->{'name'} eq 'storeTrainInfo' )
{
$found = 1;
$string = buildShopAvailString( $names->{'onclick'} );
return $string;
}
}
}
}
if ( !$found )
{
lock $NOTRAINS;
$NOTRAINS = 1;
}
}
This works most of the times, but randomly the following error happens:
Odd number of elements in hash assignment at /usr/lib/perl5/HTML/PullParser.pm line 14.
thread failed to start: Info not collected for any events at TWEtest.pl line 552
Use of uninitialized value in numeric gt (>) at TWEtest.pl line 151.
Use of uninitialized value in addition (+) at TWEtest.pl line 153.
Use of uninitialized value in addition (+) at TWEtest.pl line 155.
Use of uninitialized value in addition (+) at TWEtest.pl line 156.
Line 552 is the creation of the PullParser.
I thought it was incomplete HTML that was causing the problem, but dumping
it showed that the HTML was complete.
Anyone encounter this error, and if so, is there a solution?
perl version:
This is perl, v5.8.4 built for i386-linux-thread-multi