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).

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\Administrator>perl -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

Reply via email to