[H-GEN] Perl Novitiates (was: CGI Troubles.)
Jason Henry Parker
jasonp at uq.net.au
Mon May 14 21:09:19 EDT 2001
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Please observe the list's charter. ]
[ Worthwhile understanding: http://www.humbug.org.au/netiquette.html ]
On Tue, May 15, 2001 at 09:52:47AM +1000, Clinton Roy wrote:
> So, (assuming that Perl doesn't add newlines when it prints,
Only if you run the interpreter with the -l option, which has other
magic associated with it.
> like
> Python does), I'd expect something like the following to work:
>
> #! /usr/bin/perl
For fecks sake! -w! -w! USE -w! USE STRICT!
> print "Content-type: text/plain\r\n";
> print "\r\n";
> print "foo";
Are you people trying to troll me into a Perl presentation or what?
#!/usr/bin/perl -w
=head1 NAME
sample.pl - show folks how to code CGI in perl (more) correctly
=cut
=head1 BUGS
Uses the more simple procedural interface to CGI.pm instead of the
object-oriented interface, in deference to simplicity.
=cut
use strict;
# use diagnostics; # for 5.6.0 and above only
use CGI qw/:standard :netscape/;
print header,
start_html('This is how one writes CGI scripts in perl'),
h1('USE the -w flag'),
blink('Code without the -w flag is like running with scissors.'),
h1('USE STRICT'),
blink('The strict pragma can save you from entire worlds of hurt.'),
end_html;
jason
--
||----|---|------------|--|-------|------|-----------|-| |--||----|-|
| Jason Henry Parker play: jasonp at uq.net.au |
| Available on #soc.bi on openprojects work: jparker at pisoftware.com |
||--|--------|--------------|----|-------------|------|---------|-----|-|
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.
More information about the General
mailing list