I just got my new issue of Dr. Dobb's Journal in the mail, and what do I find? An article by one of our own perlmonks on generating JavaScript code using Perl. Nifty things like generating an array of check boxes and then generating the JavaScript code to let a user easily check or uncheck all the boxes at once...almost makes me want to learn more JavaScript :-)
(actually, I just bought the O'Reilly book, seeing as it was 30% off at B&N)

I'm not sure if the article will be online, it is only in hardcopy for now...

------------
ooo  O\O  ooo tilly was here :,(
  • Comment on Generating JavaScript from Perl (article in DDJ)

Replies are listed 'Best First'.
Re: Generating JavaScript from Perl (article in DDJ)
by Biker (Priest) on Apr 11, 2002 at 07:21 UTC

    I do that quite often myself. I have a rather complex Intranet Web site. I generate a lot of JavaScript from my Perl code.

    The trick is to know what should be done by JavaScript. And then starts the old and true mantra...

    "Never trust a users input data."

    The users input data is no more trustworthy because it's been mangled by JavaScript. The JavaScript code can be executed completely under the users control.

    OTOH, JavaScript can be very helpful to show the user how to navigate the site, how to fill in the data entry fields, giving dynamic help and hints depending upon already chosen options or data entered in key fields.

    The important thing to remember is that when the data is sent up to the server, it must be verified a second time. And that the server script is the ruling body. If the JavaScript approved the data but the server side script doesn't, then the JavaScript is wrong.

    JavaScript has been given a bad reputation. I believe this is because JavaScript has been used for things it definitively should not be used for. It's supposed to be a help for the user, think user interface, not to be part of the data processing software.


    Everything went worng, just as foreseen.

Re: Generating JavaScript from Perl (article in DDJ)
by VSarkiss (Monsignor) on Apr 11, 2002 at 14:35 UTC

    This was what brother footpad was alluding to in DDJ Monk Easter Egg. He provides a link to an online version of the article (PDF) as it was presented at YAPC 2001.

      I missed that one. I even tried Super Searching before I posted. Oh well, its neat enough to be mentioned twice, and long enough after the fact to not be too much of a spoiler :-)
      ------------
      ooo  O\O  ooo tilly was here :,(
      
A reply falls below the community's threshold of quality. You may see it by logging in.