Hi there from a newbie,

I am pretty new to perl. I have recently read the following item from the monks:
Link to Javascript::SpiderMonkey Sample
I applaud the author for their work. Thanks. I understand learning more about this was left by the author of the write, as an exercise, but I am still confused. The main part for confusion is the section that has the following:

$js->property_by_path("document.location.href"); $js->property_by_path("window"); $js->property_by_path("navigator.userAgent"); $js->property_by_path("navigator.appVersion"); $js->function_set("toLowerCase", sub {return lc($_[0]); }); $js->function_set("javaEnabled", sub {undef});
I don't understand how one is suppose to figure out what to use here for a given script that I am trying to process. Is there anyone out there that can explain this in a little more detail, please?

Also, the author creates the evaluated response content from the headers of the returned information, plus the content of a page. Can someone explain the reason for including the header information?

I mainly just want to read in a file that is .js and identify links created by the script. Is there a generic way to define the
$js->property_by_path..... $js->function_set.....
in a generic manner that should work for most scripts?

Thank you for your patience with this beginner.

In reply to Javascript::SpiderMonkey setup question by locked0wn

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.