I have a really old perl system (about 8-10 years old) but big (files with more than 100 + pm). Now, for some reason, you need to "reconfigure" it - step by step.
One of the first things I want to do is insert my pragma into each module:
use MySw::PerlDefs;
what will things like Modern :: Perl and / or like in this question contain: How to make "use My :: defaults" with modern perl and utf8 settings?
QST1: What is the recommended method?
by adding use MySw::PerlDefs;
we get
package MySw :: SomePackage;
use MySw :: PerlDefs; #my new "pragma"
or add PerlDefs enclosed in a BEGIN block after the package declaration? eg:.
package MySw :: SomePackage;
BEGIN {use MySw :: PerlDefs;} #my new "pragma" in the BEGIN block
Questions:
- What is the preferred method?
- What are the differences and / or disadvantages?
Ps: I understand how BEGIN is called at compile time, but in the above context, is this no better than simple use?
source share