Unless I am terribly wrong, CGI.pm doesn't mind outputting Javascript or HTML or XML or whatever. As far as it goes it's all text and it is resolved client-side (i.e. in the browser of the user).
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law