perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: [mp2] directive/setupenv.t test on Win32
Date Mon, 13 Dec 2004 05:37:47 GMT
On Sun, 12 Dec 2004, Stas Bekman wrote:
[ ... ]

> Well, that's not exactly what I was suggesting. Now we get skip on unix,
> when we releally need only one variable.
>
> Index: t/directive/setupenv.t
> ===================================================================
> --- t/directive/setupenv.t      (revision 111669)
> +++ t/directive/setupenv.t      (working copy)
> @@ -23,4 +23,24 @@
>
>   ok t_cmp $env{REQUEST_URI}, $location, "testing REQUEST_URI";
>
> -ok not exists $env{HOME};
> +{
> +    # on Win32, some user environment variables, like HOME, may be
> +    # passed through (via Apache?) if set, while system environment
> +    # variables are not. so try to find an existing shell variable
> +    # (that is not passed by Apache) and use it in the test to make
> +    # sure mod_perl doesn't see it
> +
> +    my $var;
> +    for (qw(SHELL USER OS)) {
> +        $var = $_, last if exists $ENV{$_};
> +    }
> +
> +    if (defined $var) {
> +        ok t_cmp $env{$var}, undef, "env var $var=$ENV{$var} is ".
> +            "set in shell, but shouldn't be seen inside mod_perl";
> +    }
> +    else {
> +        skip "couldn't find a suitable env var to test against", 0;
> +    }
> +
> +}

That works fine for me, Stas - Win32 falls through to the OS
environment variable, and $env{OS} it is undefined, so all
the directive/setupenv.t tests pass. Thanks!

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message