in reply to cookie question

This is a little unclear to me. Do you mean that you have a user agent you wrote which creates a cookie and then javascript from the page you are accessing with your user agent is supposed to set the cookies value? If that is the case then I this is fairly difficult to do. I would look into the Javascript module. I have never used it but it may solve the problem of telling perl what to do with all that nasty javascript.