Re: modifying @INC permanently

2006-06-08 Thread Anthony Ettinger

On 6/8/06, Chad Perrin <[EMAIL PROTECTED]> wrote:


> Yes.  Recompile Perl setting the appropriate compile-time flags.  More
> importantly, though: Why?  It is just easier to install your modules
> in the standardly defined place for site-specific modules.


By install do you mean cp myMod.pm to /my/path/ ??



--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: modifying @INC permanently

2006-06-08 Thread Anthony Ettinger

You do not need logic to do that.  It would seem better to use:

  use lib '/path/to/my/misplaced/perl-modules';


The point is to not have to specify a local path at all:

use lib qw(/path);
push(@inc, '/path');

Each script tests for OS: linux/sunos, and win32, and pushes the path
to @INC accordingly, based on path names. I tried File::Spec, but use
lib won't take a variable as it's evaluated before runtime, so that
left me with push.




--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: modifying @INC permanently

2006-06-08 Thread Chad Perrin
On Thu, Jun 08, 2006 at 01:59:46PM -0700, Lawrence Statton wrote:
> > Is there a way to modify @INC for the perl installation as a whole?
> 
> Yes.  Recompile Perl setting the appropriate compile-time flags.  More
> importantly, though: Why?  It is just easier to install your modules
> in the standardly defined place for site-specific modules.

Why:  I find that often remote servers (such as webhosting account
servers) that are not under one's sole control lack modules the
programmer wants, and cannot have them added in the standard path for
@INC.  This can cause problems when someone wants to use something
written by someone else, or write something that makes use of a given
module.

That's probably why.  It's certainly the reason that comes to mind for
me.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"Real ugliness is not harsh-looking syntax, but having to
build programs out of the wrong concepts." - Paul Graham

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: modifying @INC permanently

2006-06-08 Thread Lawrence Statton
> Is there a way to modify @INC for the perl installation as a whole?

Yes.  Recompile Perl setting the appropriate compile-time flags.  More
importantly, though: Why?  It is just easier to install your modules
in the standardly defined place for site-specific modules.

> 
> All my scripts have logic to push the same directory to @INC. It's
> rather repetative.
> 

You do not need logic to do that.  It would seem better to use:

  use lib '/path/to/my/misplaced/perl-modules'; 

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
sort them into the correct order.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: modifying @INC permanently

2006-06-08 Thread Timothy Johnson

Win32 changes to the environment from within your script won't be
permanent, so that won't work unless you do the system call that sets
the environment variable permanently (and also the local one, because it
won't reflect the changes to the system call until it is invoked again).

Do you have the ability to install modules on your clients?  The
SetEnvVar function from Win32::AdminMisc will do what you want.

http://www.roth.net/perl/adminmisc/#SetEnvVar

You can install it via PPM from the repository
http://www.roth.net/perl/packages.


Really, though, I think I remember that it's better to 'use lib' than
change @INC.  Someone here might be better able to explain why.



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Anthony Ettinger
Sent: Thursday, June 08, 2006 1:40 PM
To: Perl Beginners
Subject: modifying @INC permanently

Is there a way to modify @INC for the perl installation as a whole?

All my scripts have logic to push the same directory to @INC. It's
rather repetative.

I know I can export PERL_LIB environment variable, but I need
something for all system users (including win32).



-- 
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




modifying @INC permanently

2006-06-08 Thread Anthony Ettinger

Is there a way to modify @INC for the perl installation as a whole?

All my scripts have logic to push the same directory to @INC. It's
rather repetative.

I know I can export PERL_LIB environment variable, but I need
something for all system users (including win32).



--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]