in reply to Re: HTML::Form->Parse (Perl) not working under Fedora Core 1
in thread HTML::Form->Parse (Perl) not working under Fedora Core 1

Thanks for the suggestion.

However, as I expected, adding this code yields the following behavior:

1. On the Fedora Core 1 system running perl 5.8.1:

 $VAR1 = undef;

2. On my old RH8 system running perl 5.8.0:

$VAR1 = bless( { 'extra_attr' => { 'name' => 'f' }, 'enctype' => 'application/x-www-form-urlencoded', 'action' => bless( do{\(my $o = 'http://www.google.co +m/search')}, 'URI::http' ), 'method' => 'GET', 'inputs' => [ bless( { 'value' => 'en', 'name' => 'hl', 'type' => 'hidden' }, 'HTML::Form::TextInput' ), bless( { 'value' => 'ISO-8859-1', 'name' => 'ie', 'type' => 'hidden' }, 'HTML::Form::TextInput' ), bless( { 'maxlength' => '256', 'value' => '', 'name' => 'q', 'type' => 'text', 'size' => '55' }, 'HTML::Form::TextInput' ), bless( { 'value' => 'Google Search', 'name' => 'btnG', 'type' => 'submit' }, 'HTML::Form::SubmitInput' ), bless( { 'value' => 'I\'m Feeling Lucky +', 'name' => 'btnI', 'type' => 'submit' }, 'HTML::Form::SubmitInput' ) ] }, 'HTML::Form' );
So again, for some reason the same code that parses the form properly under RH8.0/perl 5.8.0 is not parsing the form properly under Fedora Core/perl 5.8.1. Note that under both systems, I have no trouble just getting the html source -- the problem appears to only be with forms (also this problem happens on all websites -- google of course is just an example...)

Replies are listed 'Best First'.
Re: Re: Re: HTML::Form->Parse (Perl) not working under Fedora Core 1
by Anonymous Monk on Dec 23, 2003 at 23:06 UTC
    I did some brute-force troubleshooting using trusty "print" statements to trace the problem back from my script to the Form.pm module to the TokeParser.pm module.

    Specifically, HTML::Form->Parse, calls "get_tag" (in TokeParser.pm) which returns 'undef'. This occurs, because in "get_tag", the "$self->get_token" statement keeps returning tokens of type "T" until it runs out of tokens.

    When I do the same debugging on the working RH8.0/perl5.8.0 version, I get a mix of tokens of types "T", "S", and "E" so that 'undef' is not returned and things work ok.

    My limited perl skills did not allow me to trace this back further, but hopefully this will shed some light on the problem...

    Any thoughts on what might be causing all of this?

        ...and I was then able to *fix* the problem by REBUILDING the package 'perl-HTML-Parser-3.26-18.i386.rpm' under my new Fedora Core 1 system. Apparently, the Fedora people had simply taken the same package that was compiled under perl 5.8.0 and assumed it would be compatible when moved to 5.8.1

        PROBLEM SOLVED!!! I will now report this to Fedora bugzilla.

      OK... I have now *really* narrowed it down.

      Everything works ok, if I remove the following "optimization" line from the 'parse' subroutine in Forms.pm:

      eval { # optimization $p->report_tags(qw(form input textarea select optgroup option)); };
      For some reason though, this optimization works ok in RedHat8.0/perl5.8.0 but fails to work correctly in Fedora Core 1/perl5.8.1