Short answer: the strict variable declaration check occurs before the import.
Long answer: the entire program compiles, then it runs. require is a runtime operation here. So is the import() call. When those happen together, as in the case of use, the implicit BEGIN block forces those operations to occur during compilation. Any code after that (in terms of line number in the file) is subject to any changes as a result of any import() operations.
Perl always performs the strict variable checking during compilation time; that's the earliest it can possibly do so. There's no (good) way Perl can know that you intend to modify the compilation environment at runtime, so it won't delay the variable checking. Nor would you want it to in general; that'd lead to unpredictable behavior.
The best solution is to put jim in its own package. You can work around the problem by wrapping that package and the import() call in BEGIN blocks.
In reply to Re: Importing variables from package within same script
by chromatic
in thread Importing variables from package within same script
by moensch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |