Oleg R. wrote:
> Grettings to everyone! I use apache for my web server and mod_perl for
> an output filter. Everything works fine, exept one thing. I want my
> perl-filter to be able to read some data from an htaccess file ,
> dependind on the web-site. I want for some sites to add an advertising
> banner , and information whether the site should have banner or not is
> written from mysql to htaccess file in the web site directory. Now the
> problem is that mod_perl filter does not see any variables that i set in
> htaccess. For exemple I set "PerlSetEnv Banner 1" or "PerlSetVar Banner
> 1" and then from the filter I check $ENV{'Banner'} and there is no such
> variable. I spent some time searching the web, and nothing. What do i do
> wrong?? Thanks a lot for your time!!!!

$ /usr/local/etc/apache22/vhosts >cat net.p6m7g8.test.conf
[snipped to relevant parts]

Options Indexes FollowSymLinks MultiViews Includes
AllowOverride FileInfo ## I AM IMPORTANT!
Order allow,deny
Allow from all


SetHandler modperl
PerlResponseHandler TEST::Nothing
PerlOutputFilterHandler TEST::OutputFilter


$ /www/sites/net/p6m7g8/test/htdocs >cat .htaccess
PerlSetEnv A a
PerlSetVar C c
SetEnv B b

$ /www/sites/net/p6m7g8/test/htdocs/TEST >cat OutputFilter.pm
package TEST::OutputFilter;

use strict;
use warnings FATAL => 'all';

use Data:umper;

use base qw(Apache2::Filter);

use Apache2::Const -compile => qw(OK);

sub handler : FilterRequestHandler {
my $f = shift;

my $env = Dumper(\%ENV);

$f->print($env);

Apache2::Const::OK;
}

1;

$ /www/sites/net/p6m7g8/test/htdocs/TEST >cat Nothing.pm
package TEST::Nothing;

## core
use strict;
use warnings FATAL => 'all';

## cpan

## mod_perl2
use Apache2::Const -compile => qw(OK);

## custom


sub handler {
my $r = shift;

return Apache2::Const::OK;
}

1;

Working Sample:
http://test.p6m7g8.net/filter_env

Output:
$VAR1 = {
'PATH' =>
'/home/pgollucci/bin:/home/pgollucci/vms:/usr/local/gnu-autotools/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin',
'MOD_PERL_API_VERSION' => 2,
'A' => 'a',
'MOD_PERL' => 'mod_perl/2.0.2'
};




--
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F 6A47 D55A 7172 A799 97F

When I call your name, Girl, it starts to flame
Burning in my heart, Tearing it all apart..
No matter how I try My love I cannot hide....