Resorted to overriding it with this line which causes $response-> code to be the first one:
sub LWP::UserAgent::redirect_ok { 0 }; The only problem is the complaint while using -w. Somebody referred to that as a "nasty hack", others agreed. But it works. Instead of 200 OK on the redirected page (second response) they look something like this: 302 Object moved http://www.esdsystems.com/qanda/qanda.asp 302 Found http://www.high-voltage-assoc.com Just noticed can get rather fancy with it: 47 sub LWP::UserAgent::redirect_ok { 48 my $return_value = 1 ; 49 $return_value = 0 if $url =~ /ECE\/newsite/o ; 50 return $return_value ; 51 } Sorry I know it's a beginner group but just thought the solution might be useful to someone. Actually the most enlightening thing for some might be how I got some of the info: http://www.google.com/search?as_q=sub+LWP%3A%3AUserAgent%3A%3Aredirect_ok&num=1 00&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all &as_occt=any&as_dt=i&as_sitesearch=&safe=off Script is working beautifully now. Perl debugger was essential in straightening a few things out. Luckily a few things are beginning to sink into my thick skull. And to think, wasn't that long ago I was wondering what $a =~ s/this/that/ was all about. /g > -----Original Message----- > From: Gary Hawkins [mailto:[EMAIL PROTECTED]] > Sent: Sunday, December 30, 2001 8:11 AM > To: [EMAIL PROTECTED] > Subject: Detect redirected URL as originally 404 > > > I want to scan a list of URL's for bad ones. The following is largely from > 'perldoc lwp'. The particular bad URL is being redirected to a custom 404 > page, so it returns 200 instead. Is there some way to know if the > request has > been redirected? If so, is there a way to know *why* it was > redirected, i.e., > get that original result code? >
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]