[sf-perl] A simpler perl technicality question.

George Hartzell hartzell at alerce.com
Wed Dec 2 08:16:03 PST 2009


I got a lot out of the discussion of local, Exporter, and symbol
tables.  It got me thinking that all y'all might have something to say
about a simpler question.

Assuming that you're not using Moose, it's well known that you should
'use strict' and 'use warnings'.  I've habitually put them after my
package declaration, but I've been reading through Ricardo Signes code
(Dist::Zilla is pretty darn useful) and I've noticed that he puts them
before the package distribution.  Perlmodlib says that 'Some pragmas
are lexically scoped [...] Others affect the current package instead
[...]' but doesn't do a good job explaining which are which.  Along
the same lines I believe I've heard that doing '-w' is different than
'use warnings' but didn't file away the details.

So, from a maximal safety point of view:

  use strict; use warnings;
  package FOO;

or 

  package FOO;
  use strict; use warnings;

and how does -w fit in?

Thanks for any clarity you can bring,

g.


More information about the SanFrancisco-pm mailing list