Re: setting environment variables

[prev] [thread] [next] [Date index for 2005/02/02]

From: Randy Kobes
Subject: Re: setting environment variables
Date: 04:53 on 02 Feb 2005
On Tue, 1 Feb 2005, Stas Bekman wrote:

> colin_e wrote:
> > Geoff,
> >    I ran into some weirdness in this area (on a Win XP
> > machine running Apache 2.0.52) that seemed to be related
> > to using lowercase environment variable names.  It
> > looked as if PerlSetEnv uppercased the variable names,
> > whereas SetEnv just ignored vars with lower case names.
> >
> > Sounds weird I know, and I didn't pin it down exactly,
> > but try uppercase variables and see if this works for
> > you.
>
> That's probably due to the differences of how perl and
> Apache interpret environ on win32. mod_perl really calls
> perl's funcs to get the env. I'm sure if you try that on
> the command line (plain perl) you will see the same
> behavior. something like:
>
> setenv foo bar (whatever it is on win32)
> perl -le 'print $ENV{FOO}'
>
> on unix that won't work, but on win32 it should print 'bar'.

That's right, Stas - on Win32,
   C:\> set foo=bar
   C:\> perl -le "print $ENV{FOO}"
prints "bar".

> I believe Randy has mentioned this before.
>
> How does mp1 deals with that?
>
> Randy?

There is a difference in this respect between mp1 and mp2.
For example, with a registry script that has
   print "Foo = $ENV{Foo}<BR />";
   print "FOO = $ENV{FOO}<BR />";
   print "foo = $ENV{foo}<BR />";
one obtains:

- under Apache1/mp1,
   SetEnv Foo Bar
   SetEnv FOO BAR
yields
  Foo = BAR
  FOO = BAR
  foo = BAR
whereas
   PerlSetEnv Foo Bar
   PerlSetEnv FOO BAR
yields
  Foo = BAR
  FOO = BAR
  foo = BAR
So under mp1, SetEnv and PerlSetEnv behave the same,
as far as case goes.

- under Apache2/mp2,
   SetEnv Foo Bar
   SetEnv FOO BAR
yields
  Foo = bar
  FOO = bar
  foo = bar
whereas
   PerlSetEnv Foo Bar
   PerlSetEnv FOO BAR
yields
  Foo = BAR
  FOO = BAR
  foo = BAR

So the behaviour of SetEnv changed from Apache-1 to
Apache-2, as far as Win32 case goes, while PerlSetEnv
maintained the same behaviour from mp1 to mp2.

I suppose one could argue that we should change
PerlSetEnv under mp2 to lower-case things, so as
to be consistent with SetEnv?

        -- 
        best regards,
randy

(message missing)

setting environment variables
Octavian Rasnita 09:47 on 30 Jan 2005

Re: setting environment variables
Geoffrey Young 14:10 on 30 Jan 2005

Re: setting environment variables
colin_e 22:31 on 01 Feb 2005

Re: setting environment variables
Stas Bekman 03:52 on 02 Feb 2005

Re: setting environment variables
Randy Kobes 04:53 on 02 Feb 2005

Re: setting environment variables
Stas Bekman 13:18 on 02 Feb 2005

Re: setting environment variables
Frank Wiles 18:20 on 30 Jan 2005

Re: setting environment variables
Pratik 18:29 on 30 Jan 2005

Re: setting environment variables
Stef1 19:26 on 30 Jan 2005

Re: setting environment variables
Randy Kobes 06:26 on 03 Feb 2005

Re: setting environment variables
colin_e 14:28 on 04 Feb 2005

Generated at 08:54 on 14 Mar 2005 by mariachi v0.52