in reply to How to tell if a URL returned a Location: header?

In the general case, you can backtrack the response chain using the previous method for HTTP::Response objects. I got a lot of help in this example from the GET script that comes with LWP:
use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $url = "http://imdb.com/find?nm=on;mx=20;q=eliza%20dushku"; my $response = $ua->get($url); my @chain = ( $response ); while ( $chain[0]->previous ) { unshift @chain, $chain[0]->previous; } for (@chain) { printf "%s %s --> %s\n" => $_->request->method, $_->request->url->as_string, $_->status_line; } __END__ GET http://imdb.com/find?nm=on;mx=20;q=eliza%20dushku --> 302 Found GET http://imdb.com/name/nm0244630/ --> 200 OK
For your purposes, it's probably simpler to just compare the URL of the final HTTP::Response object with the one you gave to the UserAgent. If they're different, you must have encountered some sort of redirect:
my $response = $ua->get($url); if ( $response->request->url->as_string ne $url ) { ... }

blokhead