RE: Does PERL5LIB work under IIS?

2006-01-20 Thread Steven Manross
 I don't understand how environment variables and @INC play 
 together on Win32. I have an IIS server (5.0 I believ), with 
 a system environment variable
 
   PERL5LIB=c:/agdata/libperl
 
 Given a simple CGI script, run under IIS:
 
 print HTML;
 content-type: text/plain
 
 PERL5LIB=$ENV{PERL5LIB}
 HTML
 print inc=$_\n for @INC
 __END__
 
 I get the following output:
 PERL5LIB=C:/agdata/libperl
 inc=C:/Perl/lib
 inc=C:/Perl/site/lib

I don't think this is an IIS thing..  I don't have a PERL5LIB
Environment Variable defined on my system at all. (ActivePerl 5.8.6
Build 811)

However, you should be able to push the path to @INC from your script (I
think it needs to be in a BEGIN block, but I'm not sure).  I've never
really found a need to include a path that is not in the normal Win32
paths since everything I do is via PPM (and it throws the module in the
lib or site\lib folders -- PPM makes for easy installs and versioning)
-- with the exception of Mail-SpamAssassin, and it installs to the
site\lib folder as well.  Good Luck.

Steven

 
 I would have expected that the directory pointed to by 
 PERL5LIB would be listed in the @INC array, but it's not (and 
 a module that appears in said directory cannot be found). On 
 a Unix machine, I get something like the following:
 
 % perl -I/tmp/libperl -le 'print for @INC'
 /tmp/libperl
 /usr/local/lib/perl5/site_perl/5.8.6/mach
 /usr/local/lib/perl5/site_perl/5.8.6
 /usr/local/lib/perl5/site_perl/5.8.3
 /usr/local/lib/perl5/site_perl
 /usr/local/lib/perl5/5.8.6/mach
 /usr/local/lib/perl5/5.8.6
 


___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Does PERL5LIB work under IIS?

2006-01-20 Thread Steven Manross
 

 -Original Message-
 From: David Landgren [mailto:[EMAIL PROTECTED] 
 Sent: Friday, January 20, 2006 9:32 AM
 To: Steven Manross
 Cc: perl-win32-web@listserv.ActiveState.com
 Subject: Re: Does PERL5LIB work under IIS?
 
 Steven Manross wrote:
  I don't understand how environment variables and @INC play 
 together 
  on Win32. I have an IIS server (5.0 I believ), with a system 
  environment variable
 
PERL5LIB=c:/agdata/libperl
 
  Given a simple CGI script, run under IIS:
 
  print HTML;
  content-type: text/plain
 
  PERL5LIB=$ENV{PERL5LIB}
  HTML
  print inc=$_\n for @INC
  __END__
 
  I get the following output:
  PERL5LIB=C:/agdata/libperl
  inc=C:/Perl/lib
  inc=C:/Perl/site/lib
  
  I don't think this is an IIS thing..  I don't have a PERL5LIB 
  Environment Variable defined on my system at all. (ActivePerl 5.8.6 
  Build 811)
  
  However, you should be able to push the path to @INC from 
 your script 
  (I think it needs to be in a BEGIN block, but I'm not sure).  I've 
  never really found a need to include a path that is not in 
 the normal 
  Win32 paths since everything I do is via PPM (and it throws 
 the module 
  in the lib or site\lib folders -- PPM makes for easy installs and 
  versioning)
  -- with the exception of Mail-SpamAssassin, and it installs to the 
  site\lib folder as well.  Good Luck.
 
 Pushing directories to @INC is trivial. I currently have the 
 following awfulhak to make this work:
 
 BEGIN {
  my ($lib) = ($ENV{PERL5LIB} =~ m{^([cd]:(?:/\w+)+)$}i);
  push @INC, $lib;
 }
 
 But the thing is I *don't* want to have to do that to each 
 and every web script, it's too painful. Maybe I should 
 explain the end goal.
 
 I have three seperate Win32 boxes. I have a Perl search 
 directory for in-house modules which, for historical reasons, 
 is in different directories on different drives for the three 
 machines. PERL5LIB lets me abstract that difference away. 
 (And hopefully one day bring them back into line).
 

You are probably looking for Config.pm (look at c:\perl\bin\config.pl as
well)..

I've not used it myself, but there's html and POD docs on them for their
use, but I think you'd want to look at modifying these values (to supply
your additional library paths):

installvendorarch
installvendorlib

In the Config.pm

Good luck.

Steven

 So I have standard Activestate Perl installations (albeit with ppm
 additions) sitting in one place, and my in-house modules in a 
 completely different directory. This allows me keep the AS 
 stuff and my stuff completely separate. And the way the house 
 works, it's just better that way.
 
 For command line programs, this works as advertised:
 
 C:\Documents and Settings\Administratorperl -le print for @INC
 C:/agdata/libperl
 c:/Perl/lib
 c:/Perl/site/lib
 .
 
 It does not work for IIS, and I wish it did. If there's 
 another way of pushing stuff onto @INC, like editing a sekret 
 file hidden away in c:/perl/.../ I'd settle for that.
 
 David
 --
 It's overkill of course, but you can never have too much overkill.
 
 
 

___
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs