in reply to Re^3: redirection issue with WWW::Mechanize
in thread redirection issue with WWW::Mechanize

OK, I solved it. The following does work:

$agent->follow_meta_redirect;


but only if you do NOT also have this in your code:

$agent->requests_redirectable( [] );


Alternately, you can also just parse the content returned by:

$post_response->decoded_content()


when the page containing the redirect is first loaded, and get the redirect URL from that. Again, the key is that you must NOT have:

$agent->requests_redirectable( [] );


in your code. I think it's strange that if you enable redirects you still must manually retrieve the redirect URL, and if you disable redirects then even manually retrieving the URL doesn't work.