Reputation: 221
I was hoping to check for webpage redirects using Perl. I've tried using LWP but it only catches 503 redirects and not htaccess redirects or Javascript redirects. Any help would be greatly appreciated.
Thanks
Upvotes: 1
Views: 529
Reputation: 677
Or take a look at WWW::Mechanize and Test::WWW::Mechanize. You can say for example to follow some link or to click some button. Then you can just simply check if the response status code matches qr/3\d\d/
Upvotes: 0
Reputation: 98398
LWP defaults to processing 3xx redirects (I think you are calling these htaccess redirects) for GET and HEAD, but you can modify this by setting the requests_redirectable option, or by subclassing LWP and catching the requests_ok callback, or by calling simple_request instead of request.
For javascript redirects, you will need to handle javascript; I'm not sure what the current best means of this is, but there are ways to do it.
You probably also want to check for meta tag refresh redirects.
Upvotes: 4