in reply to Script using WWW::Mechanize fails to log in

fwi, this is a simplified version that works ok.

Form (monk.html)

<html> <head> <title>test mech</title> </head> <body> <form action="/cgi/process.cgi" METHOD="get" name="enterLogin" > <input type="text" size="8" name="id"> <input type="password" size="8" name="pwd"> <input type="image" src="pic/pic01.jpg" border="+0"> </form> </body> </html>
The script called by the form (process.cgi)

#!c:\Perl\bin\perl.exe use warnings; use strict; use CGI::Simple; use CGI::Carp (qw(fatalsToBrowser)); my $q = CGI::Simple->new(); print $q->header; my $pwd = $q->param('pwd'); my $id = $q->param('id'); print " <html> <head> <title>test mech</title> </head> <body> <p>hi there</p> <p>id: $id</p> <p>pwd: $pwd</p> </body> </html> ";
And the Mech script

#c:/Perl/bin use warnings; use strict; use WWW::Mechanize; my $m = WWW::Mechanize->new( autocheck=>1 ); my $agent = LWP::UserAgent->new; $agent->cookie_jar(HTTP::Cookies->new); $m->get("http://localhost/monk.html"); my $r = $m->submit_form( fields => { id => "XXXXXXX", pwd => "YYYYYYY", } ); print $m->content;
Output:

---------- Capture Output ---------- > "c:\perl\bin\perl.exe" m.cgi <html> <head> <title>test mech</title> </head> <body> <p>hi there</p> <p>id: XXXXXXX</p> <p>pwd: YYYYYYY</p> </body> </html> > Terminated with exit code 0.
Having the image field instead of a submit button didn't seem to hurt.

Hope that helps.