On Mon, Apr 22, 2002 at 10:26:49AM +0800, Peter N Lewis wrote:
> Is there any way to globally add an INC directory to Perl after compilation?
> 
> I know about setenv PERLLIB5 and do that in my .cshrc.
> 
> 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).

Apps launched from the GUI (i.e., bbedit) don't inherit from your login 
shell, so they don't get setting from your .cshrc.

You can use setting in your ~/.MacOSX/environment.plist to set variables which 
will be inherited in the finder. e.g:

        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE plist SYSTEM
        "file://localhost/System/Library/DTDs/PropertyList.dtd">
        <plist version="0.9">
        <dict>
            <key>PERL5LIB</key>
            <string>/home/rick/lib/perl:/usr/local/perl5/lib</string>
        </dict>

As for cron, I'm not sure if it will inherit the same variable so, quoting 
from crontab(5):

     An active line in a crontab will be either an environment setting or a
     cron command.  An environment setting is of the form,

         name = value

     where the spaces around the equal-sign (=) are optional, and any subse-
     quent non-leading spaces in value will be part of the value assigned to
     name.  The value string may be placed in quotes (single or double, but
     matching) to preserve leading or trailing blanks.  The name string may
     also be placed in quote (single or double, but matching) to preserve
     leading, traling or inner blanks.

     Several environment variables are set up automatically by the cron(8)
     daemon.  SHELL is set to /bin/sh, and LOGNAME and HOME are set from the
     /etc/passwd line of the crontab's owner.  HOME and SHELL may be overrid-
     den by settings in the crontab; LOGNAME may not.

So, yu can either put "SHELL=/bin/csh" in your crontab to get it to read the
..cshrc file (a VERY BAD idea btw, as many thinks may break if your default 
shell is csh.), or you can set PERL5LIB directly in the crontab.


rick

Reply via email to