[Pdx-pm] Perl CGI apps and javascript

Juan Jose Natera naterajj at gmail.com
Fri Mar 2 15:29:06 PST 2007


On 3/2/07, Andrew Clapp <andrew.clapp at gmail.com> wrote:
> Allow me to clairify, I'm using CGI::Application.  It has you return your
> output at the end of each "function" and it prints it for you.
> I guess I'm wondering if I should be using the header_add function to apply
> the new javascript before CGI::Application prints.

You're confusing the headers here, CGI::App's header_add is for HTTP
headers, like cookies, content type, etc. On the other hand, if you
want to include javascript, one of the ways of doing it is putting it
in the inside a <script></script> section in your html's
<header></header> section.

The advice given by Michael still applies.

Juan J. Natera

P.S. If you're doing AJAX, you could read HTTP headers that contain JS
code and eval it but that sounds like a lot of unnecessary trouble and
not what you really need.

More information about the Pdx-pm-list mailing list