Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

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

In reply to RE: RE: Book Review - Perl and CGI for the World Wide Web by Ovid
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 drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found