SPUG: dynamic 'use lib'

Scott Blachowicz scott at mail.dsab.rresearch.com
Wed Mar 6 19:54:34 CST 2002


On Wed, Mar 06, 2002 at 04:58:42PM -0800, Daryn Nakhuda wrote:
> 
> is there a way to do something along the lines of:
> 
> $libdir = "/usr/local/foo";
> use lib $libdir;
> use BAR; # which is in $libdir
> 
> I get the following:
> Empty compile time value given to use lib

My guess would be that 'use' is a compile time thing and that '$libdir'
setting is a runtime thing.  So, maybe something like this:

    BEGIN {
      $libdir = "/usr/local/foo";
      use lib $libdir;
      use BAR;
    }

would do the trick.

Scott

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org





More information about the spug-list mailing list