On Sun, Mar 15, 2009 at 11:37 AM, Ludwig Isaac Lim <[email protected]> wrote:
> Your answers lead me to think of some follow-up questions, namely:
> a) How do I prevent namespace collision like in my case? As I said I
> tried "use warnings, -w
> flags", but it didn't me any warnings. There has to be an easier way than to
> memorize the names of
> perl's standard modules :-)
I usually just check if there's a module of the name(space) I want to
use via perldoc, e.g.
$ perldoc -l My::Wanted::Name # See if there's a module file/pod
for that name
$ perldoc -m My::Wanted::Name # See if there's source for that module
> b) I tried putting a BEGIN{ Exporter::Verbose=1} (sorry if there is a
> typo, my Perl book is
> at the office). The above BEGIN statement is supposed to verbosely list all
> the modules loaded
> into your program. I saw "A" module loaded, but I didn't see the "B" module
> loaded (which
> surprised me now, since there is a "B" module that comes along with perl.
No typos there ;)
B actually exports functions by request, hence the `use B' invocation
in your original script didn't load any functions from the core B
module.
> c) Is the Perl -I <dir> a standard practice for working with use defined
> modules? Any other
> good practices? Sorry for the fishing expedition :-)
There are quite a few ways, true to TMTOWTDI:
(a) using FindBin (http://perldoc.perl.org/FindBin.html):
use FindBin;
use lib "$FindBin::Bin"; # Find modules in the script's directory
use My::Module;
(b) using local::lib (http://search.cpan.org/dist/local-lib/):
use local::lib; # Find modules in "~/perl5"
(c) setting the PERL5LIB environment variable directly
--
Zak B. Elep || http://zakame.spunge.org
[email protected] || [email protected] || [email protected]
1486 7957 454D E529 E4F1 F75E 5787 B1FD FA53 851D
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph