Is there any way to globally add an INC directory to Perl after compilation?
But it doesn't get set when I run Perl from within BBEdit or cron.
Is there any way to do this so it is truly global (it can just be
across me as the user or for all users, since I'm the only user
anyway, as long as that will work with things like BBEdit and cron).
[I did not want to add it to every script because I want my scripts
to be machine independent and my system to define where the libraries
are at]
Answer 1 from Dan Kogai Jerry Levan:
Add the line:
push INC , /my/custom/path;
or better:
use lib '/my/custom/path';
to the start of all affected scripts.
This works everywhere, but you have to add this in to each perl script.
You could use the FindBin module to make it based on where the script
is which would improve it, but it does add a bunch of guf at the
front of each script.
Answer 2:
add the line
setenv PERL5LIB /my/custom/path
to your .cshrc
This works from scripts run from the terminal, but not from BBEdit or cron.
Answer 3 from David Wheeler Rick Frankel:
You can get set PERL5LIB in ~/.MacOSX/environment.plist. When you set
environment variables there, they are set for the OS X GUI as well
as for the shell, so it'll work in BBEdit, for example.
?xml version=1.0 encoding=UTF-8?
!DOCTYPE plist SYSTEM
file://localhost/System/Library/DTDs/PropertyList.dtd
plist version=0.9
dict
keyPERL5LIB/key
string/my/custom/path/string
/dict
/plist
This does not work in cron, and apparently there is a slight overhead
to using environment variables. You must logout and log back in for
this to take effect.
Answer 4 from Rick Frankel:
For cron, you can set environment variables in the crontab, just add the line:
PERL5LIB=/my/custom/path
to the start of the crontab - or better yet, use the CronniX
application and configure the Environment variables via the menu
command.
So essentially, you could use Answer 1, or all of Answers 2, 3 and 4.
Enjoy,
Peter.
--
http://www.interarchy.com/ ftp://ftp.interarchy.com/interarchy.hqx