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

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.

Replies are listed 'Best First'.
Re: Javascript::SpiderMonkey setup question
by Anonymous Monk on Feb 26, 2010 at 00:10 UTC
    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?

    Its not for you, please move along to WWW::Scripter::Plugin::JavaScript or WWW::Mechanize::Firefox

      I appreciate the information/recommendations, but I would sincerely appreciate a little help on this request, directly dealing with the topic. The only way I am going to get the control of what I want to do is learn how to play with Javascript::SpiderMonkey. I know me being new to perl isn't the best situation here, but I would appreciate feedback that will help me learn in the area I want to learn. When someone wants to swim, who has never done so, do you toss them a life-preserver and tell them to use that instead? We all must learn at the bottom at some point. I am a fast learner. I was recommended to the monks by a good friend and I know the answer or a better recommendation is out there somewhere.
        There is just too much to learn and very little of it related to perl. You seem want to partially implement a DOM, but why bother when somebody has already done the hard work? Heck, you can even study and learn from their implementation.