http://www.perlmonks.org?node_id=263138


in reply to Re: Re: Things every perl programmer should know?
in thread Things every perl programmer should know?

Actually ... chanting:
use strict; use warnings;
in this community earns elevation via XP. But you do raise very good points, and seeing that you have been programming longer than myself, i realize that you are speaking straight from the "real world" gut. However, i would change "something all new Perl programmers should learn" to "something all new Perl programmers will eventually have to deal with". (as i didn't with one nameless company - instead i left.)

The difference is that i would rather see advice to use strict and warnings than not. The fact that this doesn't happen as often as it should in the real world (let's face it - software design is hard!) doesn't mean that a new Perl programmer shouldn't excercise good practices now before they become ... tainted. Teach 'em the rules now, let 'em break the rules after the learn them. And Perl is all about breaking rules. ;)

Besides, not all companies suffer from the "don't look back" syndrom that seems to accompany leaving strict and warnings out of production code ... i happened to work for two that used strict and warnings in production, as well as CVS religiously and Use Cases regularly. Maybe this wasn't necessary, but we didn't waste time tracking down and fixing obscure bugs either. ;)

UPDATE:
I should mention that the one place i don't use strict and warnings is when i write one-liners. My logic is that one-liners are true throw away scripts, and if you need strict and warnings, then it probably shouldn't be a one-liner.
perl -MCGI=foo -le"print foo{bar=>baz}=>qux"

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: (jeffa) 3Re: Things every perl programmer should know?
by barbie (Deacon) on Jun 06, 2003 at 12:10 UTC
    Teach 'em the rules now, let 'em break the rules after the learn them

    That was my point on particular mailing list. There are far too many new programmers, not just in Perl, that have never been taught good programming. In Perl scripts using warnings and strict helps you in learning some good Perl programming practices.

    When writing C programs, I always used 'lint' before compiling and to me warnings and strict are the equivalent. It has taken time, but most Perl programmers I've worked with have gotten used to adding -w/use strict without thinking. In a company I used to work for, they had to port a badly written application to mod_perl. It took several months. The app that I was working on took a couple of weeks to be mod_perl compliant. They have since seen the light :)

    Another thing every Perl programmer should be taught is Testing. Its amazing how often the Test:: modules can keep you sane, when all else is driving you nuts with fustration.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Barbie
    Birmingham Perl Mongers
    Web Site: http://birmingham.pm.org/
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~