SPUG: dynamic 'use lib'

Yitzchak Scott-Thoennes sthoenna at efn.org
Wed Mar 6 22:41:57 CST 2002


In article <20020306175434.A13745 at sabami.seaslug.org>,
Scott Blachowicz <scott at mail.dsab.rresearch.com> wrote:
>    BEGIN {
>      $libdir = "/usr/local/foo";
>      use lib $libdir;
>      use BAR;
>    }

That is equivalent to the following:

BEGIN {
  require lib;
  lib::->import($libdir);
  require BAR;
  BAR::->import();
  $libdir = "/usr/local/foo";
}

which is not quite good enough.

$libdir= needs to be in a BEGIN of its own.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     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