Something like this may help...
if ($res->is_success) {
#Normal retrievel of content stuff
}else{
#check for redirects
if ($res->code() =~ /30[12]/){ #redirect codes (temp/perm)
#grab the location
my $remote_cgi = $res->header('Location');
{
# Some servers erroneously return a relative URL for redirects,
# so make it absolute if it not already is.
local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1;
my $base = $res->base;
$remote_cgi = $HTTP::URI_CLASS->new($remote_cgi,$base)->abs($ba
+se);
}
}else{
# Request failed normaly, broken link
}
Where $res is your result object
---If it doesn't fit use a bigger hammer