Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

merlyn (47)

AOL IM: realmerlyn (Add Buddy, Send Message)
Yahoo! ID: realmerlyn (Add User, Send Message)

See my home page [].

Journal of merlyn (47)

Monday March 22, 2004
02:11 PM

Shades of the mid-90's

[ #18014 ]
Check out this dialog I had with a perl-beginner@yahoo subscriber starting with the head message. In essence, he took a 5000-line "auction" script written perl4 style from the mid-90's, updated it a bit, then posted it as an example of "good code for beginners to learn from".

Yeah, maybe as an example of what not to do!

I can't tell whether I should be more scared about his defensiveness at being called to the carpet, or the fact that the script has about a half dozen eval-string ops, generally taking their operand from unchecked CGI form fields. Yuck.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • His retort [] is interesting:

    "Newbies don't start programming perl by using packages and/or objects. I'm very sure that the use of packages and/or objects is 'overcoded' in case of a simple program like this.

    He's right that new Perl programmers won't jump right in to packages and objects -- though I don't know what makes him think they'll jump in to a 5000-line auction script.

    And if a 5000-line script isn't screaming for modularization, I don't know what is.

    • A long time ago I learned a term that's stuck with me to this day: position release. When I have an obstacle to personal growth or learning, it means that I have some sort of personal position on a matter that I need to let go of. Even to this day, I have to constantly remind myself that when someone points out another way of doing something, even if I disagree with it, I need to figure out why they're pointing it out so I can attempt to learn from them. It's a tough thing to do.

      • Another way of saying that is that no matter how crazy someone sounds to you, there is a reality in which what they said makes sense, and they're apparently living in that reality. It's a useful mind exercise to be able to reconstruct their reality: it's also useful for diffusing a rapidly escalating disagreement.

        Not that I ever apparently do that, of course. {grin}

        • Randal L. Schwartz
        • Stonehenge
    • There is also a huge difference between writing packages and using available packages.

      Telling a beginner how to use a package that cuts down the code they would write from 5000 lines (to choose a random number :-) down to a few dozen lines that focus on the overall operation and leave the details to the underlying package is a necessary and important lesson that should happen early.

  • It's no wonder people complain about messy looking perl when stuff like this keeps resurfacing as 'examples'.

    Every CGI I write uses taint-mode, warnings, strict, and

    I can't tell you how many times I've had people call me to do maintenance on an old script to add some small additional functionality and I've had to either convince them that I should rewrite the entire thing from scratch, or turn them down outright since I won't add my name to the list of people responsible for it breaking or being c