Executing script on FreeBSD 6.0

Hello everyone,

I have a problem to run a script on my FreeBSD 6.0 server. The script is in /usr/local/nagios/libexec/. It runs fine if I run into me in this directory. By cons, if I run it from another directory, it tells me it can not find the file utils.pm (found in /usr/local/nagios/libexec/ and he would therefore need). Now I need to run this script from another directory.

I tried putting the absolute path, but it does nothing. I also added the directory /usr/local/nagios/libexec/ in the PATH, but nothing either There must be some subtleties with the BSD I do not know ...

Thank you for your help!
 
This has nothing to do with FreeBSD. It's a Perl script and should be treated as such. Setting the shell's PATH does absolutely nothing for the way Perl searches for it's modules.

Perldoc: lib
 
Thanks for your analyse. But what do you think I must do with perl? Script is an binary file, so ... For information, this script has no problem if I execute it from a Linux RedHat.
 
Yes, sorry I have just read my mistake.
It is a script, begin by :

Code:
!/usr/bin/perl -w

If I type :

Code:
-bash-2.05b# which perl
I have :

Code:
/usr/bin/perl

If I type :

Code:
-bash-2.05b# /usr/bin/perl -v
I have :

Code:
This is perl, v5.8.7 built for i386-freebsd-64int

Is it wrong to run my script ?
 
There's nothing wrong. Read the perldoc link I posted.
 
Based on the perldoc link above, you need to modify the script. The "use lib" lets you add directories to the module search path. Does that help?
 
Back
Top