[Pdx-pm] CGI.pm question about start_html(-script)

Michael G Schwern schwern at pobox.com
Mon Jul 19 15:17:37 CDT 2004

On Mon, Jul 19, 2004 at 12:26:52PM -0700, Thomas J Keller wrote:
> Greetings CGI.pm users,
> I would like to call more than one external javascript script in a 
> workrequest form I'm writing using CGI.pm. How do I code that in the 
> start_html() method?

The interface is documented but a bit nasty.  It really should work as
you expected (ie. have src take an array ref) but I have the feeling
Lincoln has little sympathy for JavaScript.

       A final feature allows you to incorporate multiple <script> sections
       into the header.  Just pass the list of script sections as an array
       reference.  this allows you to specify different source files for dif-
       ferent dialects of JavaScript.  Example:

            print $q->start_html(-title=>'The Riddle of the Sphinx',
                                           { -language => 'JavaScript1.0',
                                             -src      => '/javascript/utilities
                                           { -language => 'JavaScript1.1',
                                             -src      => '/javascript/utilities
                                           { -language => 'JavaScript1.2',
                                             -src      => '/javascript/utilities
                                           { -language => 'JavaScript28.2',
                                             -src      => '/javascript/utilities

       If this looks a bit extreme, take my advice and stick with straight CGI

Michael G Schwern        schwern at pobox.com  http://www.pobox.com/~schwern/
Follow me to certain death!

More information about the Pdx-pm-list mailing list