Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

how can i execute javascript in perl

by navorinco (Initiate)
on May 08, 2009 at 10:35 UTC ( [id://762797]=perlquestion: print w/replies, xml ) Need Help??

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

hello. i recently learn perl script. however, i have some problem. i made cgi script and i want to execute javascript in there. but that's not execute. if you know what i fault something.. plz teach me..

Replies are listed 'Best First'.
Re: how can i execute javascript in perl
by almut (Canon) on May 08, 2009 at 11:15 UTC

    What exactly are you trying to do?  Executing JavaScript server-side from within a CGI script is quite an unusual requirement, so I'm suspecting it might not actually be what you're intending to do... Maybe you want to execute some JavaScript code (generated by the CGI script) in the browser?

    Could you show your CGI script?

Re: how can i execute javascript in perl
by LanX (Saint) on May 08, 2009 at 10:58 UTC
    JavaScript "Note that this module is not a JavaScript compiler/interpreter written in Perl but an interface to the SpiderMonkey engine used in the Mozilla-family of browsers."

    JE "is a pure-Perl JavaScript engine"

    Cheers Rolf

    UPDATE: I've gained no personal experience with either module yet!
Re: how can i execute javascript in perl
by przemo (Scribe) on May 08, 2009 at 11:20 UTC
    • Just to be sure: CGI runs on server; "browser" JavaScript runs... well, on browser, i.e. on the client side. You can't just call the client's JavaScript from the server (but you may instruct the browser to do so, e.g. using <body onload="..."> event hooks).
    • Please, use search functions of Perlmonks on how to run JavaScript interpreter on the server side, there's a lot of it, e.g. javascript interpreter in perl???.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: how can i execute javascript in perl
by Anonymous Monk on May 08, 2009 at 10:50 UTC

    If you want to execute javascript, use a javascript interpreter, not perl.

      yes , i want to call a javascript scipt from a perl script
        Why do you need to do that?
Re: how can i execute javascript in perl
by dorward (Curate) on May 08, 2009 at 21:48 UTC

    If you want to run the JavaScript on the server then you could use something like JavaScript::SpiderMonkey.

    If you want the Perl to just output an HTML document that includes some JavaScript for the browser to execute - then do that, it is just text wrapped with <script> and </script>.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://762797]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-24 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found