where does one put use strict

Ryan, Martin Martin.Ryan at sensis.com.au
Tue Oct 1 23:28:28 CDT 2002

Hi Scott,

The perlfunc manpage explains in general terms what "use" does before going
on to say this;

               Because this is a wide-open interface, pragmas
               (compiler directives) are also implemented this
               way.  Currently implemented pragmas are:
                   use integer;
                   use diagnostics;
                   use sigtrap qw(SEGV BUS);
                   use strict  qw(subs vars refs);
                   use subs    qw(afunc blurfl);
               Some of these these pseudo-modules import
               semantics into the current block scope (like
               strict or integer, unlike ordinary modules, which
               import symbols into the current package (which are
               effective through the end of the file).
My interpretation of this is that pragamas are effective from when they're
mentioned through to the end of the current block scope which in your case
is the end of the current file.  Earlier up the man page "use" is defined as
equivalent to;
       BEGIN { require Module; import Module LIST; }
So, I'd suggest that when you do a "use blah" and the blah module has a "use
strict" before the package line, you're going to "require" the module, and
the "strict" diretive will be in effect from when it's mentioned through to
the end of the file that has the blah module - blah.pm under normal


-----Original Message-----
From: Scott Penrose
To: melbourne-pm at pm.org
Sent: 2/10/02 13:37
Subject: where does one put use strict

Hey Dudes,

I have been working on some code which inserts 'use strict' before the 
package line
	use strict;
	use warnings;

	package Blah;
	use Another;

Now what concerns me about this is that strict and warning then appears 
outside of the package, and therefore in whatever contains the use, or 
does it ?

What is the effect of putting these outside of the package line ?

Scott Penrose
VP in charge of Pancakes
scottp at dd.com.au

Dismaimer: If you receive this email in error - please eat it 
immediately to prevent it from falling into the wrong hands.

More information about the Melbourne-pm mailing list