Документация
HTML CSS PHP PERL другое

5.6 Caveat Programmer

 
Previous Table of Contents Next

5.6 Caveat Programmer

use strict and use warnings may be very helpful, but don't assume that they're going to catch all your mistakes. Perl leaves a lot of checking to run time. Look what happens when we take the limerick and make an innocuous change:


%  perl -Mstrict -Mwarnings -c

There was a young man from Maastricht

Whose programs just never had clicked

Until he discovered

The bugs he had smothered

Leaving out warnings & strict

^D

- syntax OK

Perl's compiler thinks this is just dandy. Fortunately it doesn't do anything, but the run time error is the same without warnings and strict as with.

So much for panaceas.

Another word of warning: You'll find many examples of code in documentation and books that isn't warnings- or strict-safe, usually by omitting to declare variables with my. Don't take them to be endorsements of programming without the strict and warnings pragmas; their authors are simply being economical with their example code and don't view the pragmas or my keywords as being important to understanding the examples.

    Previous Table of Contents Next
    © 2000- NIV