2011/7/14 Shlomi Fish <shlo...@shlomifish.org>

> Hi Marc,
>
> On Thu, 14 Jul 2011 07:18:55 -0700
> Marc <sono...@fannullone.us> wrote:
>
> > >> #!/usr/bin/perl
> > >> use Text::CSV;
> > >> use DBI;
> > >> use Data::Dumper;
> > >
> > > There is no "use strict;" and "use warnings;" at the beginning of the
> file:
> >
> >       I see this quite a bit on this list (and elsewhere) and I think
> it's
> > very good advice, so this morning I got to thinking.  If these pragmas
> are as
> > important as they are, why is it that they aren't turned on in Perl by
> > default?
>
> Because doing so will break old code. perl 4 and below didn't have "use
> strict;" and the -w flag (which is the precursor to the now more
> recommended
> "use warnings;") was also introduced a bit later. So if we turn them on by
> default, then it will break a lot of code.
>
> > How about if we make them the default settings in 5.16 and then add
> > "use nostrict;" and "use nowarnings;" for when someone wants to turn them
> > off?
>
> Well, if you do "use 5.012;" then strict will be turned on by default:
>
> http://www.effectiveperlprogramming.com/blog/468
>
> Also, there's http://beta.metacpan.org/module/Modern::Perl and doing "use
> Moose;" (see http://www.iinteractive.com/moose/ ) will also enable "use
> strict;" and "use warnings;".
>
> > In the grand scheme of things I'm still relatively new to all this, but
> > it makes total sense to me.  If they should be used in most every script,
> why
> > waste the time and thought of always having to remember (or remind
> others) to
> > add them?
>
> Well, a good idea is to configure your editor to add them for you
> automatically.
>

Or use something along the lines of "use Modern::Perl;" to also switch on
some useful stuff..

Paolo Gianrossi

(An unmatched left parenthesis
 creates an unresolved tension
 that will stay with you all day
                                   -- xkcd

Reply via email to