SPUG: dynamic 'use lib'
Yitzchak Scott-Thoennes
sthoenna at efn.org
Wed Mar 6 19:35:14 CST 2002
In article <Pine.LNX.4.33.0203061656130.1848-100000 at well.marinated.org>,
Daryn Nakhuda <daryn at marinated.org> 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
BEGIN { $libdir = "/usr/local/foo"; }
use lib $libdir;
use BAR;
BEGIN{} executes code at compile time, so you can't use anything in it
that is only set at runtime. If you need to set it at runtime, you'll
need to use require.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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