[perl:LWP::UserAgent]中的302如何处理了?

[perl:LWP::UserAgent]中的302如何处理了?

好像我要实现自动登陆了phpMyAdmin之类的?我看到有$ua->requests_redirectable与$ua->redirect_ok就不知道如何使用?
phpMyAdmin是先进setcookie再redirect本身,最后才进行登陆校正!用curl就比较差,用wget就可以自动处理。如何用perl实现
wget中的302处理功能了?
just like
$r->err_headers_out->add('Set-Cookie' => $cookie);
$m->redirect('/main.html');
?
根本不用处理,LWP 会自动帮你处理。
前提是你得用下面的命令授权 LWP 这么做。

[Copy to clipboard] [ - ]
CODE:
    push @{ $ua->requests_redirectable }, 'POST';

if ($method eq "OST"
{
$response = $ua->request(POST "$url", \%PARAMS, %HEADERS);
}
else
{
my $reqstr = "$url?$uservar=$uid&$passvar=$pwd&$others";
$reqstr =~ s/[\n\r]//g;
$response = $ua->request(GET "$reqstr", %HEADERS);
}
my $page = $response->content();
my $code = $response->code();


if ($code eq "200" && $page !~ /$failure/ig)
{
print "$uidpwd *** WORKED ***\n";
print RF "$uidpwd *** WORKED ***\n" if ($logfile ne '');
}
else
{
  if ($code eq "302" && $page !~ /$failure/ig)
  {
   push @{ $ua->requests_redirectable }, 'GET';
   print $response->code();
  }
  else
  {
   print "$uidpwd ($code)\n";
   print RF "$uidpwd ($code)\n" if ($logfile ne '');
  }
}

这个push @{ $ua->requests_redirectable }, 'POST';放到哪里了?