in reply to Login, post, reload.

You're working too hard on those cookies. Just tell your useragent that you're interested in cookies:
$ua->cookie_jar(HTTP::Cookies->new(file => ".cookies", autosave => 1)) +;
And now all requests will automatically be cookiefied, and the responses will be cookie-extracted, and the cookies will be saved between sessions, just like a browser!

-- Randal L. Schwartz, Perl hacker