my $agent = WWW::Mechanize::Firefox->new(autoclose => 0); $agent->get($url); # check if page has a login cached page if ($cached) { $agent->form_number('1'); $agent->field(j_username=>$username); $agent->field(j_password=>$password); $agent->submit(); die unless ($agent->success); } else { #Now we retrieve the download page for downloading usage records. my $usagepage="$url$usagelink"; $agent->get($usagepage); $agent->form_name($usageform); $agent->field("#dateFrom",$datefrom); $agent->field("#dateTo",$dateto); #this now brings out the download prompt dialog box # and requires action $agent->eval_in_page('doExport();); # Need to now obtain file somehow... die unless ($agent->success);