http://qs321.pair.com?node_id=316287


in reply to Re: Re: Perl module problem
in thread Perl module problem

There aren't any negative consequences codewise from doing it, even if you are importing stuff. For example, occasionally when debugging I'll throw use Data::Dumper; print Dumper $foo in the middle of some code. Dumper is an imported subroutine in this usage and works just fine so long as it's used in the same package it's imported into.

The problem is not with writing functional code but with writing readable, maintainable code. Novice programmers, probably like the AnonyMonk here, might read such code and think mistakenly that use works at runtime like require or eval "use Foo";. Moreover, someone maintaining your code, even if an experienced Perl programmer, isn't generally going to scan your codebase looking for embedded use statements because it's customary to place them at the top of the file, and that could lead to confusion, for example in case of conflicts with imported symbols. In short, yeah you can get away with it, but it introduces a maintenance risk.


"The dead do not recognize context" -- Kai, Lexx