Hi

I'm actually using a WWW::Scripter, a subclass of WWW::Mechanize. So, my script for the most part works. I had an issue where Javascript detection was being used to detect non-browsers. My PHP Curl script which had worked fine for years all of a sudden broke. Using WWW::Scripter (recommended in a thread started here!) has basically saved me, although there are some pitfalls.

my $cookie_jar = HTTP::Cookies->new( file => 'cookie_jar.dat', autosa +ve => 1 ); my $w = new WWW::Scripter( agent => 'Mozilla/5.0 (X11; Li +nux x86_64; rv:2.0) Gecko/20110411 Firefox/4.0', cookie_jar => $cookie_jar ) ; $w->add_header( 'Accept' => 'text/html,application/xhtml+xml,applicati +on/xml;q=0.9,*/*;q=0.8' ); $w->add_header( 'Accept-Language' => 'en-us,en;q=0.5' ); $w->add_header( 'Accept-Encoding' => 'gzip, deflate' ); $w->add_header( 'Encoding' => 'euc-jp' ); $w->add_header( 'Keep-Alive' => '115' ); $w->add_header( 'Connection' => 'keep-alive' ); $w->add_header( 'Cache-Control' => 'max-age=0' ); $w->add_header( 'Referer' => undef ); $w->use_plugin( 'JavaScript' ); $w->get( $page_url );
As you can see, I'm not doing anything ninja-like. Pretty standard. Using HttpFox and with Curl in debug mode, I saw that calling get( $page_url ) would send a couple of cookies, and authenticate my session. The essence of the script is to login. However (I assume due to the Javascript parsing) the performance is quite bad. Having to not go through the 2-page login process for each instance would help. Unfortunately I can't see if it's sending the cookie or not. I've got the following set, as per WWW::Mechanize's FAQ
use LWP::Debug qw(+);
...but I'm not seeing any extra output. Am I missing something about setting the cookie jar? Am I missing something about LWP::Debug?

Happy Friday to each and all!

In reply to WWW::Mechanize Cookie debugging by GaijinPunch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.