in reply to LWP ignoring cookies??

actually i have not much practice with the LWP project, but from my distant point of view you might receive the cookie when you omit the line $ua->cookie_jar({});. according to the pod from LWP::UserAgent the field is initially undefined. so from my understanding explicitly setting it to an empty hash reference overrides the default behaviour and will result in an attempt to send an empty cookie together with the request - which is, however, not conforming to http standards.
--------------------------------
masses are the opiate for religion.

Replies are listed 'Best First'.
Re^2: LWP ignoring cookies??
by Massyn (Hermit) on Jan 05, 2008 at 06:02 UTC
    Nope, still the same. Even trying the script on Win32 (Activestate Perl) does the same.
      Ok, this worked...
      my $ua = LWP::UserAgent->new( cookie_jar =>HTTP::Cookies->new( file => + '/tmp/cookies.txt', autosave => 1, ignore_discard => 1 ));
      and then I had to make sure that /tmp/cookies.txt exists, and that it's accessable. Silly though - I would have expected the in-memory cookie jar to operate...
        use LWP; my $ua = LWP::UserAgent->new; $ua->cookie_jar({}); my $response = $ua->get('http://www.google.com/'); use Data::Dumper; print Dumper($ua);
        Proof of concept that it works fine with {} as the cookie jar.
        in memory should work, do you have latest LWP?