in reply to app not storing cookies (using LWP::UserAgent)

I don't see any place where you're telling $browser to use cookies at all!

To do so, assuming you can discard the cookies once $browser is gone, you can do this:

my $browser = LWP::UserAgent->new; $browser->cookie_jar({}); ...

If that's not the case, pass in an HTTP::Cookies object (or an object that subclasses that class) or provide appropriate options within the hashref instead of just using an empty hashref (LWP::UserAgent->cookie_jar() assumes that a hashref is options to create an HTTP::Cookies object for itself.

Replies are listed 'Best First'.
Re^2: app not storing cookies (using LWP::UserAgent)
by Anonymous Monk on Apr 16, 2009 at 20:20 UTC
Re^2: app not storing cookies (using LWP::UserAgent)
by FireBird34 (Pilgrim) on Apr 17, 2009 at 16:17 UTC
    I think I'm able to get the cookie passed now, however for some reason, browser is not accepting it still. Curious to know if 'Set-Cookie3' matters or not when pushing the cookie? If so, how am I able to set it to 1 or 2?

    updated code -- different area in the code for my sanity (to make sure cookie actually takes).
    my $ua = LWP::UserAgent->new; my $cookie_jar = HTTP::Cookies->new(); $cookie_jar->load("test.txt"); $ua->cookie_jar(); my $banUrl = 'http://website.com/mod/ban.php'; my $request = $ua->request(POST "$banUrl", { banUser => 'name here', submitBan => 'Ban User' }); if($request->is_success){ print "worked\n"; }else{ print "failed\n"; } print "Content: ".$request->content."\n";
    The result is that it 'worked', however the 'content' reply is not logged in still. Something simple I'm sure, but I'm racking my brain searching for this.

    My 'test.txt' file is in Set-Cookie3 format (the default)