I have been having trouble getting the HTML::Form library to work under Fedora Core 1 (perl 5.8.1-92 with perl-libwww-perl-5.65-6). For some reason, the function HTML::Form>Parse doesn't return any forms for me.
For example, the following simple perl script:
#! /usr/bin/perl
use HTML::Form;
use HTTP::Request;
use LWP;
my $ua = new LWP::UserAgent;
my $uri="http://www.google.com";
my $req = HTTP::Request->new(GET => $uri);
my $res = $ua->request($req);
print $res->content;
my $form = HTML::Form->parse($res->content, $res->base());
print "Form: ${form}\n";
Returns the source of the www.google.com page but fails to return the obvious embedded form.
If instead, I make the last line:
join(" ", $form->form);
I get the corresponding error message:
"Can't call method "form" on an undefined value at ./myscript.pl line 14"
which occurs presumably because no form is returned!
I did not have any problems with this previously under RH8.0 with perl 5.8.0-88 and perl-libwww-perl-5.65-2.noarch.rpm
In fact, the above perl scripts still work when under Fedora Core 1 I 'chroot' to my old RH8.0 installation. It thus seems to be that something is wrong with the Fedora Core 1 perl environment.
Any suggestions on what might be going on and how I might troubleshoot it further?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.