Perl: can you make a "use"d module or setting apply to the including script? -
for example, every single 1 of scripts has @ top:
use warnings; use strict; use v5.10; use tools;
my "tools" package has bunch of functions use time. rather include , have use warnings, strict, , 5.10 including script, since have use
every script anyway. there way that?
you can use import::into custom import
method turn stuff on in importing class. example:
package tools; use strict; use warnings; use feature ':5.10'; use import::into; sub import { $target = caller; strict->import::into( $target ); warnings->import::into( $target ); feature->import::into( $target, ':5.10' ); # other imports, etc }
i wrote more detailed post using import::into here: removing perl boilerplate import::into.
Comments
Post a Comment