On Sun, Jul 14, 2013 at 5:11 PM, Meir Guttman <[email protected]> wrote:
> Hey folks! > Some typical newbie questions with regard to 'use': > 1) Let's assume that both 'Main' and one of its packages (or two packages) > are using the same "My::Package", does that means that My::Package is > loaded > *twice* into memory? Not likely, right? > The file is read, parsed, and initialized once, but its import routine is run on every use. > 2) What if the two invocations are exporting different lists of methods? > No problem. Each consumer will see its own symbols. If you used the same module twice from the same package, you can expect to see the union of methods you asked for. > 3) What are the pros and cons of exporting ":all" methods rather than just > the ones in use? > The issue is brevity vs. namespace pollution. If you import too many names into your own package, you risk confusion if more than one different things happen to be imported with the same name. Also, when you import :all, whoever reads your code needs to guess if they want to know where the code is coming from. > Thanks > Meir > > _______________________________________________ > Perl mailing list > [email protected] > http://mail.perl.org.il/mailman/listinfo/perl > -- Gaal Yahas <[email protected]> http://gaal.livejournal.com/
_______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl
