Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: To CGI or not CGI, that is the question

by tadman (Prior)
on Mar 12, 2003 at 12:38 UTC ( [id://242337]=note: print w/replies, xml ) Need Help??


in reply to To CGI or not CGI, that is the question

There is no question about if one should use CGI or not. You should. The real question is if you will.

Just one look through the site you reference is enough to make me run in fear. Here's a snippet of code in what is supposed to be an educational example:
#!/usr/bin/perl print "Content-type:text/html\n\n"; # parse the form data. read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } # where is the mail program? $mailprog = '/usr/sbin/sendmail'; # change this to your own email address $recipient = 'nullbox@cgi101.com'; # this opens an output stream and pipes it directly to the # sendmail program. If sendmail can't be found, abort nicely # by calling the dienice subroutine (see below) open (MAIL, "|$mailprog -t") or dienice("Can't access $mailprog!\n"); # ... (Continues)
No warnings? No strict? This is not educational, this is a bad B-movie!

In short, if you were to use CGI, you would save yourself a lot of heartache becase the CGI routines it implements work, and work well. In fact, after a little effort to figure out how to use them, it's so easy.

Don't get scared about CGI.pm, just invest in a good book, like the Lincoln Stein one, and spend a few hours reading about it. It will save you from a world of hurt!

Replies are listed 'Best First'.
Re: Re: To CGI or not CGI, that is the question
by davorg (Chancellor) on Mar 12, 2003 at 12:59 UTC

    It's worth pointing out that the author of that site has written a followup called CGI201 which teaches a far higher level of Perl programming. She's also talking about a new edition of CGI101 which will cover things like CGI.pm, strict and warnings.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://242337]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-24 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found