Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

w2ksp4.exe, WwwxxXdbf, procmail "FROM_MAILER" patch, Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF

Links

XODOX
Impressum

#1: PerlSetEnv vars not available in PerlRequire script

Posted on 2010-07-22 16:19:14 by Steven van der Vegt

Greetings mod_perl list!

I'm upgrading old debian servers to Ubuntu 10.04 and we have to upgrade
from apache 1.x and mod_perl to apache2 and mod_perl2.x This requires
rewriting configfiles and I'm running into the following problem:

I've got (sort of) the following apache configuration:

<VirtualHost x.x.x.x:40080>

PerlSetEnv BASE /home/steven/foo/base

PerlPostConfigRequire /home/steven/foo/handler.pl

<LocationMatch "(\.mhtml)$">
SetHandler perl-script
PerlHandler Ech::Mason
</LocationMatch>

</virtualHost>

In the handler I've got this:

use Data::Dumper;
print Dumper(\%ENV);

With a apache2ctl start the output is:

$VAR1 = {
'PATH' =>
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bi n:/usr/games',
'MOD_PERL_API_VERSION' => '2',
'MOD_PERL' => 'mod_perl/2.0.4'
};

As you can see, my BASE variable is not set in the %ENV. Does anybody
knows why?

Report this message

#2: Re: PerlSetEnv vars not available in PerlRequire script

Posted on 2010-07-22 17:37:01 by Ryan Gies

Notice that PerlSetEnv is allowed in scope DIR:
http://perl.apache.org/docs/2.0/user/config/config.html#mod_ perl_Directives_Argument_Types_and_Allowed_Location

Try moving the PerlSetEnv line to inside the LocationMatch directive.
Although the above documentation indicates PerlSetVar is also of scope
DIR, I have never had a problem using PerlSetVar in the VirtualHost section.

On 07/22/2010 10:19 AM, Steven van der Vegt wrote:
> Greetings mod_perl list!
>
> I'm upgrading old debian servers to Ubuntu 10.04 and we have to upgrade
> from apache 1.x and mod_perl to apache2 and mod_perl2.x This requires
> rewriting configfiles and I'm running into the following problem:
>
> I've got (sort of) the following apache configuration:
>
> <VirtualHost x.x.x.x:40080>
>
> PerlSetEnv BASE /home/steven/foo/base
>
> PerlPostConfigRequire /home/steven/foo/handler.pl
>
> <LocationMatch "(\.mhtml)$">
> SetHandler perl-script
> PerlHandler Ech::Mason
> </LocationMatch>
>
> </virtualHost>
>
> In the handler I've got this:
>
> use Data::Dumper;
> print Dumper(\%ENV);
>
> With a apache2ctl start the output is:
>
> $VAR1 = {
> 'PATH' =>
> '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bi n:/usr/games',
> 'MOD_PERL_API_VERSION' => '2',
> 'MOD_PERL' => 'mod_perl/2.0.4'
> };
>
> As you can see, my BASE variable is not set in the %ENV. Does anybody
> knows why?
>

Report this message

#3: Re: PerlSetEnv vars not available in PerlRequire script

Posted on 2010-07-23 13:49:44 by Steven van der Vegt

> How about trying PerlSetVar instead of PerlSetEnv? And then in your
> handler dump the var you set?

This works in the handler function. There, I discovered, the ENV var is
correctly set too!. Outside this function it is not.

I try to rebuild the following handler-script.

package Foo::Bar;
use all:kinds:of:libs

my %sites = (
site1 => {
path = $ENV{PATH} # <-- USE OF ENV VAR HERE
},
siteN => {
}
);

my %ah;

foreach my $site ($keys %sites) {
$ah{$site} = HTML::Mason::ApacheHandler->new(
do things with above paths...
);
}

sub handler {
my $r = shift;
...
my $site = $r->dir_config('mason_site') || '';
$ah{$site}->prepare_request($r$);
...
}

As you can see I want to use the ENV vars in the global scope. Is this
possible?

On Thu, 22 Jul 2010 20:55:26 -0400, Mike Diehn <mike@diehn.net> wrote:
> Steven,
> I don't know why either.  Looks like you're doing it right, but that
> only means I'm missing it too.  :-)
> How about trying PerlSetVar instead of PerlSetEnv?  And then in your
> handler dump the var you set?
>     PerlSetVar      BaseDir   /home/steven/foo/base
> Good luck,Mike
> On Thu, Jul 22, 2010 at 11:37 AM, Ryan Gies wrote:
> Notice that PerlSetEnv is allowed in scope DIR:
>
>
http://perl.apache.org/docs/2.0/user/config/config.html#mod_ perl_Directives_Argument_Types_and_Allowed_Location
> [2]
>
> Try moving the PerlSetEnv line to inside the LocationMatch directive.
>  Although the above documentation indicates PerlSetVar is also of scope
> DIR, I have never had a problem using PerlSetVar in the VirtualHost
> section.
>
> On 07/22/2010 10:19 AM, Steven van der Vegt wrote:
> Greetings mod_perl list!
>
> I'm upgrading old debian servers to Ubuntu 10.04 and we have to upgrade
> from apache 1.x and mod_perl to apache2 and mod_perl2.x This requires
> rewriting configfiles and I'm running into the following problem:
>
> I've got (sort of) the following apache configuration:
>
> PerlSetEnv      BASE   /home/steven/foo/base
>
> PerlPostConfigRequire   /home/steven/foo/handler.pl [3]
>
>         SetHandler  perl-script
>         PerlHandler Ech::Mason
>
> In the handler I've got this:
>
> use Data::Dumper;
> print Dumper(%ENV);
>
> With a apache2ctl start the output is:
>
> $VAR1 = {
>           'PATH' =>
>
>
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bi n:/usr/games',
>           'MOD_PERL_API_VERSION' =>  '2',
>           'MOD_PERL' =>  'mod_perl/2.0.4'
>         };
>
> As you can see, my BASE variable is not set in the %ENV. Does anybody
> knows why?
>  

Report this message