http://qs321.pair.com?node_id=723534

Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:

I've written a scraper with WWW::Mechanize.

It logs in to a website every time I run it and returns a table of data.

So, now I'm thinking, why does it have to log in every time?

My browser doesn't have to log in every time. There's a timeout of an hour.

I've got this:

my $mech = WWW::Mechanize->new( cookie_jar => { file => "/path/to/cookies.txt", autosave => 1 } );
in my code, and that file is being written to every time the script runs, but it's empty except for "#LWP-Cookies-1.0" at the top.

There's no "remember me" option on this website, so they're only for-this-session type cookies, but why doesn't Mech save those for me? That way the website would let my script return five minutes later and see it as still logged in, just like it does with my browser.

Maybe there's something about session cookies I don't understand? Any help gratefully received.



Nobody says perl looks like line-noise any more
kids today don't know what line-noise IS ...