Hello,

Does anybody know of a way to enforce 'use strict' on
the packages used in a script?

I am building a sizable application, with plug-able
modules (packages) written in perl. I'd like to
enforce 'use strict' on the included modules, without
depending on users to put 'use strict' below each
package declaration.

A possibly identical issue is that I'd also like to
make Data::Dumper a globally `use`d package. That's to
speed up debugging of those pluggable modules. Again,
I'd like for module writers to not have to type 'use
Data::Dumper;' at the top of every package.

>From my observation, once you add the line 'package
<package-name>', declarations and pragmas get reset in
the lexical scope. Scoping of the use strict would
probably need to be controllable somehow, since there
may be important packages used by the system, that
would break under use strict

I'm thinking there must be a way to either set the use
strict scope by the order of the use-lines, where
packages used after the use strict line are required
to comply. The other possibility I'm thinking would be
the @ISA chain. Any base class that sets something
like 'use strict :inherit;' would require any
child/extending package to comply. The second option
could also solve my desire to export the Dumper sub to
all child packages.

I'm not saying that I want to compile perl to make it
use strict by default. I've read the RFCs and heated
debates over that one. I am a heavy user of 'perl -d
-e 1' for testing, so a strict default would be a real
pain for me also.

BTW, I have been a perl user, and minor CPAN
contributor for a many years, but I'm new to this
list. I hope I can start to contribute more than I'm
getting from it.

Thanks,

-Carl


Carl Eklof 
President 
Bee Software LLC 
See us in action at:http://beethere.net/
p: 917.464.3529 
f: 801.439.4213
[EMAIL PROTECTED]

 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to