How to include new dirs in @INC

Paul Schmehl pauls at utdallas.edu
Mon Jul 23 22:13:55 UTC 2007


Somehow I missed Anton's response, so I'm copying it here so I can respond 
as well.

>On Sun, Jul 22, 2007 at 11:08:44PM -0500, Paul Schmehl wrote:
>> I'm working on a port upgrade, and I'm copying some perl modules to
>> %%SITE_PERL%%/mach/newdir.  Unfortunately, the scripts won't run because
>> the perl modules aren't included in @INC.  How do I update @INC to 
include
>> the new path?  (I have USE_PERL= yes in the Makefile.)  Is there a 
script
>> I have to run?  Is there an ldconfig for perl?

> In theory, one might set environment variable PERLLIB or PERL5LIB.  This
> won't work for scripts that run with euid and ruid that differ.

> Alternatively, the scripts using the modules in a non-standard location 
must
> be modified to "use lib qw(/path)", which modifies @INC.

I can certainly do that, by patching the scripts.

> Alternatively, Perl itself needs to be recompiled with new paths.

Probably a bad choice for a port.  :-)

> Alternatively, you need to figure out whether you can place the modules 
into
> a standard location.  It looks like you are trying to do that, but clearly
> you are doing something wrong.  What are the names of the modules and 
their
> packages?

Here's the hierarchy:

ls -lsa /usr/local/lib/perl5/site_perl/5.8.8/mach/Bro/
total 64
 2 drwxr-xr-x   4 root  wheel    512 Jul 22 22:51 .
 6 drwxr-xr-x  26 root  wheel   4608 Jul 22 22:51 ..
 4 -r--r--r--   1 root  wheel   3601 Jul 22 22:51 IP4.pm
 2 drwxr-xr-x   2 root  wheel    512 Jul 22 22:51 Log
 8 -r--r--r--   1 root  wheel   6851 Jul 22 22:51 Log.pm
 2 drwxr-xr-x   2 root  wheel    512 Jul 22 22:51 Report
12 -r--r--r--   1 root  wheel  11945 Jul 22 22:51 Report.pm
28 -r--r--r--   1 root  wheel  26767 Jul 22 22:51 Signature.pm

ls -lsa /usr/local/lib/perl5/site_perl/5.8.8/mach/Bro/Log/
total 30
 2 drwxr-xr-x  2 root  wheel    512 Jul 22 22:51 .
 2 drwxr-xr-x  4 root  wheel    512 Jul 22 22:51 ..
12 -r--r--r--  1 root  wheel  11968 Jul 22 22:51 Alarm.pm
14 -r--r--r--  1 root  wheel  13654 Jul 22 22:51 Conn.pm

ls -lsa /usr/local/lib/perl5/site_perl/5.8.8/mach/Bro/Report/
total 78
  2 drwxr-xr-x  2 root  wheel    512 Jul 22 22:51 .
  2 drwxr-xr-x  4 root  wheel    512 Jul 22 22:51 ..
 54 -r--r--r--  1 root  wheel  53742 Jul 22 22:51 Alarm.pm
 20 -r--r--r--  1 root  wheel  18481 Jul 22 22:51 Conn.pm

And yes, the two subdirs contained identically named modules but they are 
different.  (IOW, the code is not identical.)

After checking the scripts, all of them refer to Bro::Module except one. 
So I can put that one module (IP4.pm) in /mach and solve the problem that 
way.  The others appear to be correctly coded.

-- 
Paul Schmehl (pauls at utdallas.edu)
Senior Information Security Analyst
The University of Texas at Dallas
http://www.utdallas.edu/ir/security/


More information about the freebsd-ports mailing list