Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

RE: Book Review - Perl and CGI for the World Wide Web

by athomason (Curate)
on Jul 08, 2000 at 09:12 UTC ( [id://21626]=note: print w/replies, xml ) Need Help??


in reply to Perl and CGI for the World Wide Web

I couldn't agree more. Sadly, I did the same thing as Ovid, since I was handed a website and told to fix it up in 3 days. I picked up Castro's book since it was the thinnest one on the shelf containing both "CGI" and "Perl" in the title. The first drafts of all my scripts used her hacked-together CGI routines... badly. Some months later (after having read the ORA books on Perl and CGI), I went back to those scripts and laughed myself silly. I rewrote the site using DBI and CGI.pm in a fraction of the time and space it had originally taken me. I don't think that introducing Perl and CGI concurrently is necessarily a bad idea, but doing it in a book that's only 272 pages cover to cover is insane. Newbies beware: this book is full of bad habits and lacks critical information. Experienced PHs won't have any use for it at all. I'll echo Ovid's summary: don't bother.
  • Comment on RE: Book Review - Perl and CGI for the World Wide Web

Replies are listed 'Best First'.
RE: RE: Book Review - Perl and CGI for the World Wide Web
by Ovid (Cardinal) on Jul 08, 2000 at 22:06 UTC
    Okay, I'm going to sit here and kick myself repeatedly. In reading your response, I remember what I forgot to include in the review: Elizabeth Castro doesn't know Perl.

    After reading through her little pamphlet (I can't dignify it with the term "book") I came to the conclusion that she needed to get a book out the door quickly and either took a class on Perl or bought a book on it and started writing. That would explain the generally poor quality of her code and why she spends so much time explaining how to FTP and how to create a Web form. Large portions of this book are spent on non-perl things. She also gets her Perl stuff wrong:

      Perl has three operators that let you look inside incoming data and act accordingly: match, substitute, and split.
    Is that so? I guess I'll have to throw away tr///;. What a shame. It's really useful.

    Another beef I have is the regex she listed to capture any phone number in the form (xxx) xxx-xxx, with the x's being replaced by digits.

    /^((\(\d{3}\))? *\d{3}(-| )\d{4},? *)+$/
    This regex really isn't bad, but it has some stumbling blocks for the novice programmer (aside form the fact that a novice won't understand it). The problems:
    • It matches numbers where the dash is replaces with a space. That's not a problem, but it's not what she said she was matching.
    • The (xxx) is optional. See my first gripe.
    • The phone number is captured into $1. Fine and dandy. But did you notice the ,? * at the end? We have an optional comma and potentially many spaces being captured. That's probably not what we want in $1.
    • And what the heck is that '+' doing before the '$'? Are we trying to capture one or more phone numbers? Again, this wasn't explained and could confuse the heck out of newbies.
    • Due to the variable-width font in the book, the spaces in the regex are difficult to see.
    These gripes may seem petty, but this is programming. We need to be very specific and not just "fudge" things. Castro should not be giving examples that are "almost" correct.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-25 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found