Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2010/08/19

Maybe quite obvious: using CGI to make a Javascript test page

I've been reading Javascript:The Good Parts on Safari, and looking through the code examples. When doing the same for Perl, I toss test.pl into an editor and add to it over and over. I suppose I could have a web page with an ever-growing SCRIPT section, but I had a more clever idea.

I made a CGI where the body is just a FORM with a TEXTAREA and a submit button, and I set it up so that when you clicked submit, the code is sent via POST (so you can be verbose) and put into the TEXTAREA and the SCRIPT block. I have a code sample, but it's as close to a textbook use of CGI.pm that I don't think there's much use to posting it.

And I could've put in a test.js and run spidermonkey, but it seems like you can't apt-get install it anymore. I've tried rhino, and just installed it again, but I didn't like it as much as spidermonkey. But if you're writing Javascript, you're likely coding for the web.

1 comment:

  1. Running code from the Perl module JSP (http://xrl.us/bhwqt7) is easy enough to do, the problem is if your code manipulates the DOM at all. There is no DOM available in the spidermonkey environment. As an alternative, you can run my port of the Sizzle CSS selector engine, Fizzle, that works with E4X (http://xrl.us/bhwqtr). I am also attempting to port the manipulation parts of jQuery over to E4X, but haven't had the time to finish it.

    ReplyDelete