BEGIN { require 'strict.pm'; strict->import(); }
So strict->import() actually applies to the lexical scope one step outside of from where import() was called (or something like that). So, the following actually works:
package AID;
require strict;
require warnings;
sub import
{
strict->import();
goto &warnings::import;
}
1;
Then:
use AID;
BEGIN { print 0+""; }
print $x;
Gives:
Argument "" isn't numeric in addition (+) at - line 2.
Global symbol "$x" requires explicit package name at - line 3.
Execution of - aborted due to compilation errors.
And diagnostics.pm isn't lexically scoped (and I'm not sure why people even use it, to be quite frank), so you can just "use diagnostics" inside your common.pm file.
|