--- "Tillema, Glenn" <[EMAIL PROTECTED]> wrote:
> Here is how I do it;
> 
> #!/usr/local/bin/perl -w
> use CGI;
> 
> print header();
> print "<head>\n",
>       "   <title>test script</title>\n";
> print <<DONE;
> <SCRIPT LANGUAGE="JavaScript">
>    alert('test');
> </SCRIPT>
> DONE
> print "</head>\n";

As written, this script won't work.  If you call the 'header()' function directly, you 
need to
import this function from CGI.  One way to do it is:

use CGI qw/:standard/;

Also, since you are already using CGI.pm, why not take advantage of its full 
functionality?

#!/usr/local/bin/perl -wT
use CGI qw/:standard/;
use strict;
 
print header();
my $javascript =<<END;
<SCRIPT LANGUAGE="JavaScript">
    alert('test');
</SCRIPT>
END
print start_html( -title  => 'test script',
                  -script => $javascript );

Note that this reads very much like the actual Web page would and is fairly easy to 
follow. 
Getting used to the built in HTML functions of CGI.pm can make the resulting HTML code 
much
cleaner.

Cheers,
Curtis Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Reply via email to