Javascript.. from perl

I’m working on a project that requires keeping code for both the server side and the client (browser) side in sync.  Instead of maintaining two distinct implementations in two distinct languages, I looked around for a JavaScript interpreter that would run on the server.  

As usual, it’s either in the CPAN, or it doesn’t exist.

http://cpan.uwinnipeg.ca/htdocs/JavaScript-SpiderMonkey/JavaScript/SpiderMonkey.html

This makes use of “jslib” from Mozilla, without any requirements on having a browser.  From inside perl I can load a block of text (javascript code from the browser side of the project), evaluate it, and then evaluate any further commands my perl script needs to issue.

(Yes, I’m new to JS, I’m sure SpiderMonkey is old news to anyone doing unit tests with javascript code..)

[permalink] · Blog ·