|
Posted by Peter Scott on January 29, 2007, 10:59 am
Please log in for more thread options
On Mon, 29 Jan 2007 04:00:37 -0800, george veranis wrote:
> use strict;
> use WWW::Mechanize;
> use HTTP::Cookies;
> my $outfile = "out.txt";
> my $url="http://opac.uom.gr/ipac20/ipac.jsp?
> profile=bib-1--1&menu=account&ts=1163590369197";
> my $username = $ARGV[0];
> my $mech = WWW::Mechanize->new();
> $mech->cookie_jar(HTTP::Cookies->new());
> $mech->get($url);
> $mech->form_name('security');
> $mech->field(sec1 => $username);
> $mech->submit_form();
>
> my $flag;
> $flag = $mech->content() =~ /Borrower ID/;
>
> open(OUTFILE, ">$outfile");
>
> if ($flag){
> print OUTFILE "Failure";
> }
> else{
> print OUTFILE "Success";
>
> }
> #print OUTFILE "$flag";
> close(OUTFILE);
>
> and I get the following message if i write perl -w namefile.pl
> <input> outside <form> at /home/cpanrun/parisc2.0-lp64/build/5.8.2/lib/
> site_perl/5.8.2/WWW/Mechanize.pm line 1825
>
> but if I run the same script under Windows I get the right results.
Firstly, that's just a warning, so the program should otherwise behave
identically on both machines.
Secondly, inspection of sources suggests that you have an older version of
HTML::Form on the first box, when it issued that message if warnings were
enabled. The current version requires a verbose flag to be set that
Mechanize does not enable. Or you're not using -w when you run the
program on the Windows box.
Thirdly, the message is alerting you to the fact that the HTML has
an <INPUT> tag (probably hidden) not between <FORM> tags. HTML::Form
won't add them as inputs to a form. Perhaps some browsers have the
"helpful" behavior of adding them to any form submitted from that page; I
don't know, but it violates the HTML standard. If the form action target
requires those inputs to be set you'll have to add them manually.
--
Peter Scott
http://www.perlmedic.com/ http://www.perldebugged.com/
|