Hello Monks,
I know:
It is better to use WWW::Firefox , or WWW::Mechanize::Selenium... but I would like to have only a textual "mech", not a GUI, so I tried with WWW::Mechanize and SpiderMonkey.

So now I have these modules, those are working toegether in the finest way (thank you, Corion!):

SpiderMonkey (not a Perl module, but you know that...)
JavaScript.pm
WWW::Mechanize
WWW::Scripter::Plugin::JavaScript
WWW::Scripter::Plugin::JavaScript::Spidermonkey


And I'm able to process JavaScript in the way I want.
Also I can read from JavaScript a cookie value, that I set with PHP (or Perl).

But I'm not able to write a cookie with JavaScript and read it.
Writing with JavaScript fails in a silent way.

Any Idea how can I write cookies with Scripter::Plugin::JavaScript?
Is it some configuration problem?

use WWW::Scripter; use HTTP::Cookies::Netscape; my $cook= HTTP::Cookies::Netscape->new(file => 'ciao.txt' ,ignore_disc +ard => 1,autosave=>1); $m = new WWW::Scripter(autocheck=>1,cookie_jar=>$cook) ; $m->use_plugin(JavaScript => engine => 'SpiderMonkey' ); $m->get( 'http://mypage/provaw.php'); my $res=$m->response(); $m->cookie_jar->extract_cookies($res); $m->cookie_jar->save; my $cookie_content = $m->cookie_jar->as_string; print $cookie_content;
please, do you have any suggestions?
Thak you!

In reply to WWW Mechanize and JavaScript Cookie by saintex

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.