I don't know if this will work or not, but you might want to try this with WWW::Mechanize (a subclass of LWP::UserAgent). Mechanize has a lot of features that make a variety of things easier, maybe it'll help with your problem.
Also, when you google around for solutions, you might want to search on mechanize as well as UserAgent, because a lot of LWPers use the fancier mechanize module.
Comment on Re: LWP::UserAgent and Passphrase protected Certificates