in reply to module location

Just do a require instead as use is a compile-time construct (as opposed to require which is done run-time)
require( shift @ARGV );
But as liz notes, that requires munging the module name for any module with a '::' seperator. Better yet, don't load the module at all and just make use of Module::Locate
use Module::Locate 'locate'; my $path = locate $ARGV[0];
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: module location
by hmerrill (Friar) on Nov 07, 2003 at 16:17 UTC
    Tried installing Module::Locate using CPAN, but got these errors:
    Module-Locate-1/lib/ Module-Locate-1/lib/Module/ Module-Locate-1/lib/Module/Locate.pm Package seems to come without Makefile.PL. (The test -f "/root/.cpan/build/Module-Locate-1/Makefile.PL" returne +d false.) Writing one on our own (setting NAME to ModuleLocate) CPAN.pm: Going to build B/BR/BROQ/Module-Locate-1.tar.gz Checking if your kit is complete... Looks good Writing Makefile for ModuleLocate /usr/bin/perl "-Iblib/arch" "-Iblib/lib" Build.PL Build Can't locate Module/Build.pm in @INC (@INC contains: blib/arch blib/li +b /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 / +usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/ +site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5 +.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/li +b/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr +/lib/perl5/5.8.0 .) at Build.PL line 1. BEGIN failed--compilation aborted at Build.PL line 1. make: *** [Build] Error 2 make: *** Waiting for unfinished jobs.... make: *** Waiting for unfinished jobs.... make: *** Waiting for unfinished jobs.... cp lib/Module/Locate.pm blib/lib/Module/Locate.pm /usr/bin/make -j3 -- NOT OK Running make test Can't test without successful make Running make install make had returned bad status, install seems impossible
    I was just going to try it, so it's not a big deal, but I thought I would let you know.
      Thanks for the heads-up, I've hopefully fixed that bug with the latest version (in anticipation of someone trying to install it ;). It also comes with a few other changes which should be useful to the folks who want to do module probing such as is_mod_loaded() and is_pkg_loaded().
      HTH

      _________
      broquaint