in reply to jQuery and Perl

Perhaps you should re read the jQuery documentation. You can't just drop Perl code into a JavaScript framework and expect it to do anything other than fail. What you want is to use jQuery (see $.get and Ajax documentation for examples) to communicate with your backend CGI scripts/application (your Perl code querying Oracle via DBI) and do whatever you see fit to the DOM with/depending on the results.

"Should I be using static HTML pages with embedded js/css/Perl, or using a Perl script with js/css inside?"

I use HTML::Template to separate my HTML/jQuery code from my Perl code.

Replies are listed 'Best First'.
Re^2: jQuery and Perl
by sierpinski (Chaplain) on May 27, 2010 at 14:40 UTC
    That's what I thought... I saw a post somewhere where someone claimed to have inserted <%perl> inside the function part of the jQuery script, but I couldn't see how a client-side function could cause any back-end processing, but I figured I'd ask anyway.

    Thanks for the advice. It'll probably be easier to support with static HTML pages anyway. If management decides to add a bunch of extra functionality later (which I guess is very likely), having Perl scripts generate all those pages would be messy anyway, let alone trying to incorporate jQuery as well.

      "having Perl scripts generate all those pages would be messy anyway, let alone trying to incorporate jQuery as well."

      Yeah, that's why I use HTML::Template, it's pretty much the same as having a standard HTML file with the exception that you can populate (via non HTML, HTML::Template specific tags) the HTML/JavaScript/jQuery/css from from Perl, in my case, our Oracle databases. Perhaps overkill for what you are working on, but I'd suggest looking at a templating system, see Framework, Templating, and Content Management Systems from the tutorials section for further reading.

      Best of luck

      Martin

        Thanks, I'll definitely check out HTTP::Template. I hadn't really looked at it before, but from what you said, sounds exactly like what I need to save quite a bit of time and effort.

        pQuery just ports the jQuery API to Perl. It does not provide any RPC mechanism and/or interpolation mechanism which would allow you to mix Perl and Javascript or to write your Javascript in Perl.