use HTTP::Request::Common;
use HTML::Form;
use LWP::UserAgent;
use LWP::Debug qw(+);
BEGIN { *LWP::UserAgent::redirect_ok = sub {1} }
use HTTP::Cookies;
use File::Basename;
$cookie = '/home/../cookie_jar.txt';
print unlink $cookie;
$ua = LWP::UserAgent->new;
$ua->cookie_jar(
HTTP::Cookies->new(
file => "$cookie",
autosave => 1 )
);
$ua->agent('Mozilla/4.73');$c=0;
# tried: file:///, file://, file:/, /myForm ...
$req = HTTP::Request->new(GET => 'file:/home/../myForm.html');
# Pass request to the user agent and get a response back
$res = $ua->request($req);
#tried various forms of: $res = $ua->request(GET 'file:///home/../myForm.html');
# execution is interrupted here.
$form = HTML::Form->parse( $res->content);
$res = $ua->request( $form->click );
# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Bad luck this time\n";
}