Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Perl and CGI for the World Wide Web

by clintp (Curate)
on Aug 10, 2001 at 07:12 UTC ( [id://103750]=note: print w/replies, xml ) Need Help??


in reply to Perl and CGI for the World Wide Web

First, some disclosure before I get going: I've got a competing (?) book on the market, Teach Yourself Perl in 24 Hours (2nd edition coming in October). It's selling well, it's been well received by the Perl Community, and the readers have really liked the book judging by the mail I get. >2/3 of the book is an introduction to Perl, the last 1/3 is the application of Perl to (horrors!) CGI programming. I have seen Ms. Castro's book and I think I even own a copy (research).

I agree with your statement about the need for a novice CGI book (that's why I wrote one). And Ms. Castro's book isn't the worst example of a book that teaches the topic. The presentation technique is unique and appropriate for the medium. I find it nearly impossible to teach CGI without drawing lots of pictures and waving my arms. 4/5 illustrations in my book appear in the CGI chapters. Writing a book in a novel format like this must have been excruciating and she did a fair job. The explanations are clear and for the most part accurate. CGI can be a hard topic to wrap your head around.

Using strict, -T and -w are good things to use when appropriate. They're not always needed. I present -T, and use it sometimes, but for the most part in these 15-20 line scripts I don't need it. And just putting -T at the top of every CGI script just because "well, that's what you do!" is just as Cargo Cultish (Randal's term) as cutting-and-pasting from Matt Wright scripts.

It so happens I used -w everywhere. Cargo Cultish? Naw. -w catches silly user typos ("used only once..."). It also seems I used strict everywhere after chapter 8. Why? For 'strict vars' mostly because I'm consistantly encouraging "self-contained" functions and argument passing and this helps you to remember to create block-scoped lexicals. Nothing more.

I don't like the explanation of how to untaint without full examples though. I deferred to perlsec here. I would have hoped there was at least a passing reference to it in her book, but I don't see one. One demerit.

Moving on... Even if the HTML were incorrect, this isn't an HTML book and isn't the place to teach it. I wouldn't expect proper and compliant HTML in a Perl/CGI book. And teaching it would obscure the topic at hand. You have to allow for some handwaving.

Speaking of handwaving. The three foreach loops? That may be appropriate for a beginners book too. Sometimes you want to take small bites, and this example DOES have three functions: display a before list, alter the list, display the after. It'd be cute (and FASTER!) to roll it all up into 2 or 1 loop. But when you're teaching new programmers (not just new Perl programmers) you have to take small steps.

Not using CGI.pm? Well, that I don't like. I'm not a big fan of CGI.pm, but at the very least it saves space in the listings for showing CGI techniques and less space for encoding/decoding things. Bad editorial decision. I think this is the only point I agree completely on.

And on a more personal note. This tone was very poor, Ovid. It is possible to give a bad review of a work and still be gracious and civil. In a public forum we should strive to be cultured and thoughtful. Bitch sessions are best done over a beer. Catch me at a conference sometime, and I'll buy you one.

  • Comment on Re: Perl and CGI for the World Wide Web

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found