in reply to Why does HTTP::Cookies and/or LWP add Google cookies to my cookie jar when visiting another site?

There are two easy ways where Google cookies could come into the mix. One is, that your cookie file is already filled with them. Then the easy solution would be to delete these lines.

The second thing is that maybe one of the URLs you fetch redirects to Google, for whatever reason. One approach to see the requests that LWP makes would be to use LWP::ConsoleLogger

use LWP::ConsoleLogger::Easy qw( debug_ua ); debug_ua($browser);

... and then watch as the requests scroll by.

  • Comment on Re: Why does HTTP::Cookies and/or LWP add Google cookies to my cookie jar when visiting another site?
  • Download Code

Replies are listed 'Best First'.
Re^2: Why does HTTP::Cookies and/or LWP add Google cookies to my cookie jar when visiting another site?
by Polyglot (Chaplain) on Apr 27, 2022 at 14:27 UTC

    Thank you for the clues. Upon investigation, emptying the cookie jar and retrying, the script now generates an error message which says:

    ./HTTP-Cookies.jar does not seem to contain cookies at /System/Library/Perl/Extras/5.12/HTTP/Cookies.pm line 432.

    ...and the file remains empty, except for this:

    #LWP-Cookies-1.0

    It was about this point that I remembered that I had pointed the script once, for testing purposes, at another website--one that I do not own. Evidently, the cookies in the jar remained permanently after that, which was not the behavior I had expected.

    I was unable to install the module you recommended, unfortunately. I got only error messages, and it failed to install. Disappointing.

    Now, why is it that the cookie jar seems necessary in order to complete the GET request? ... but maybe I'm just misunderstanding the process again.

    Blessings,

    ~Polyglot~

      Evidently, the cookies in the jar remained permanently after that, which was not the behavior I had expected.

      Persistently storing the cookies is the only reason to have a cookie jar present on the filesystem.


      🦛

        Yes, that would make sense to my mind if the cookie jar had been a 'system' file; but I had created it myself just for this particular script, and I, perhaps unreasonably, expected it to be temporary storage used only until the script had completed. Naturally, I'm learning, and thank you.

        Blessings,

        ~Polyglot~