Stephen E. Hargrove writes ..

>On Thu, 10 May 2001, King, Jason wrote:
>
>> Stephen E. Hargrove writes ..
>>
>> >how do i add new directories to @INC?  i've managed to 
>bungle one of my
>> >debian systems, and apt-get relies pretty heavily on some .pm's that
>> >aren't in the stock @INC locations.
>>
>> there's a hand module called 'lib' that's part of the CORE 
>distribution ..
>> it basically just unshifts your list onto the @INC array in 
>a BEGIN block
>>
>>   use lib qw'/dirs/for /inclusion /in/INC';
>
>
>doesn't this just make the adjustment at compile time?  what i'm really
>needing is something that will modify @INC for all time.  can that be
>done?


you need to recompile Perl then .. the directories included in the @INC
array are stored in the perl binary when Perl was originally built .. you
can't change them without rebuilding Perl

if you wanted to avoid hardcoding the @INC directories in every script you
write you could put your own module into one of the @INC directories to be
called by all your programs - and it would - in turn - load the other @INC
directories .. ie. your module might be as follows

  package my_lib;
  use lib qw'/dirs/for /inclusion /in/INC';
  1;

then in all your programs you'd have

  #!perl -w
  use strict;
  use my_lib;

  # .. code ..

  __END__

-- 
  jason king

  In Denmark, if a horse carriage is trying to pass a car and the horse
  gets uneasy, the car is required to pull over and stop. If necessary
  to ease the horse down, you are required to cover the car up. -
  http://dumblaws.com/

Reply via email to