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

Hi folks,

I'm currently scripting some daily web-formular routines with WWW::Mechanize.

On one page, I have a simple textarea field and a button. Normaly I would paste some text in that textfield, click the button and the javascript function behind that button converts the input text into some sql update statements and display them in the same textbox instead of the original text.

Because WWW::Mechanize is not capable of js code processing, I need to know how I can use this js convert function in my perl script.

I dont want to rewrite the js code into perl code, cause this is some pretty complex code and I cannot effort the time.

Thanks in advance!
Best regards, Tobi

Replies are listed 'Best First'.
Re: How to use javascript code in Perl?
by holli (Abbot) on Nov 19, 2008 at 13:08 UTC
    Have a look at Selenium and it's Perl binding. Granted, Selenium is meant for testing, but also great to abuse for browser automation.


    holli, /regexed monk/
Re: How to use javascript code in Perl?
by Corion (Patriarch) on Nov 19, 2008 at 11:29 UTC
Re: How to use javascript code in Perl?
by LanX (Saint) on Nov 19, 2008 at 11:49 UTC
    Maybe JE could help you run the JS code from within perl...
    Cheers LanX
Re: How to use javascript code in Perl?
by petr999 (Acolyte) on Nov 19, 2008 at 12:28 UTC
    i had deal with JavaScript.pm from CPAN that is based on the separate non-interactive js-interpreter library from Gecko. It can evaluate JS functions but lacks of the DOM infrastructure. The stuff it made was to grab out info ( the numbers ) obfuscated with arithmetic operations in JS from automatic crawling on a web page.