in reply to Maintaining sessions with WWW::Mechanize across script instances?

...which I confirmed by dumping the response headers

Have you also checked the request headers for the second invocation (e.g. using wireshark) to see if the old session ID is actually being sent.  This might help to narrow down on where/when it is "getting lost".

  • Comment on Re: Maintaining sessions with WWW::Mechanize across script instances?

Replies are listed 'Best First'.
Re^2: Maintaining sessions with WWW::Mechanize across script instances?
by EvanK (Chaplain) on Apr 22, 2011 at 08:52 UTC
    That was it! Saving and loading the cookie jar, apparently, wasn't actually sending the saved cookie in the next request. I'm not sure why, but I'm just manually setting the cookie header before the form submit and that solves the session problem.