I got an really old perl system (approx 8-10 years old), but a big one (100+ pm files). Now for some reason need "remodernize" it - step-by-step.
One of first thing what i want get done is insert into every module my pragma:
use MySw::PerlDefs;
what will contain things like in Modern::Perl and/or as in this question: How to make "use My::defaults" with modern perl & utf8 defaults?
QST1: What is the recommended way?
adding
use MySw::PerlDefs;
so will getpackage MySw::SomePackage; use MySw::PerlDefs; #my new "pragma"
or add the PerlDefs enclosed in the BEGIN block after the package declaration? e.g.:
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 drawbacks?
Ps: I understand than the BEGIN exectuted at compile time, but in the above context - it is not better than the "simple use"?