Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Re: Perl and CGI for the World Wide Web by clintp
in thread Perl and CGI for the World Wide Web by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-03-29 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found