
adam.prime at utoronto
Jul 10, 2008, 5:50 AM
Post #5 of 10
(1217 views)
Permalink
|
I deliberately removed CGI from the script because i personally would never use CGI in something written to be run as straight handlers, and it obviously wouldn't make any sense to use CGI in the CGI emulations, and then not use it in the Handler version. Not using heredoc's shouldn't really have any effect on the (already flawed) results, because they weren't used in any of the examples. But yeah, it was late and i should have been sleeping but i was dorking around with this instead. I'm personally not really interested in how using CGI affects the numbers, but if other people would like to see them i can do this later tonight. Adam Dodger wrote: > Oh. I would also recommend three variants, based on what people often > do, what people sometimes do, and what people probably should do when > using CGI.pm, which can make a difference (just for thoroughness): > > Usually done: > #!/usr/bin/perl > use CGI; > print header; > > print <<"EOF"; > <html> > <body> > <h1>Environment dump:</h1> > <dl> > @{[map "<dt>$_</dt>\n<dd>$ENV{$_}</dd>\n", sort keys %ENV]} > </dl> > </body> > </html> > EOF > > Sometimes do: > #!/usr/bin/perl > use strict; > use CGI; > my $cgi = new CGI; > print $cgi->header; > > print <<"EOF"; > <html> > <body> > <h1>Environment dump:</h1> > <dl> > @{[map "<dt>$_</dt>\n<dd>$ENV{$_}</dd>\n", sort keys %ENV]} > </dl> > </body> > </html> > EOF > > Might do occassionally, and probably should do all the time if using CGI: > > #!/usr/bin/perl > use strict; > use CGI(); # note the difference -- using CGI in OO mode, don't import > *anything* > my $cgi = new CGI; > print $cgi->header; > > print <<"EOF"; > <html> > <body> > <h1>Environment dump:</h1> > <dl> > @{[map "<dt>$_</dt>\n<dd>$ENV{$_}</dd>\n", sort keys %ENV]} > </dl> > </body> > </html> > EOF >
|