How to execute javascript from within perl?

J

Jon

I've written a perl script which parses a variety of webmail sites.
Unfortunately most of the work is hardcoded and picked out in regex's
because I can't seem to figure out a good way to either parse or
execute JavaScript within perl.

There is a JavaScript.pm on CPAN which I tried to use but had to code
all the DHTML classes into it using the bind_class function and began
to run into problems with things like: parent.document.frames[1].href
= 'http://www.google.com'

Right now I'm thinking about creating my own module and trying to tie
in some of mozilla's c functions/modules to execute the javascript I'm
parsing out of webpages.

Anyone know of a project that already does this or can think of a good
way to solve this problem? Thanks for any help...

Jon
 
C

Chris

Jon said:
I've written a perl script which parses a variety of webmail sites.
Unfortunately most of the work is hardcoded and picked out in regex's
because I can't seem to figure out a good way to either parse or
execute JavaScript within perl.

There is a JavaScript.pm on CPAN which I tried to use but had to code
all the DHTML classes into it using the bind_class function and began
to run into problems with things like: parent.document.frames[1].href
= 'http://www.google.com'

Right now I'm thinking about creating my own module and trying to tie
in some of mozilla's c functions/modules to execute the javascript I'm
parsing out of webpages.

Anyone know of a project that already does this or can think of a good
way to solve this problem? Thanks for any help...

You've only explained what you are trying to do and not necessarily what
problem you are trying to solve. Since it appears what you are trying
to do involves JavaScript, I'm not sure you are going to get a lot of
answers here.

I for one however am curious... Just WHAT IN THE WORLD are you trying
to solve? I've been programming for a good many years and consider
myself quite competent in both JS and Perl, but I've never run across
the need to intermix their run output in the same context. I'd like to
hear what problem you are trying to solve. Why in the world do you want
to run JS that's been scrapped from web pages where the intended target
was a client browser? You'd be hard pressed in a Perl context of
replicating the environment targeted by the JS code... Not saying it's
impossible (esp. ina Win32 WSH environment), but a fair amount of HTML
bound JS is tied to the DOM...?

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top