Changing apache config with mod_perl, doesnt work!

--Apple-Mail-7--696646639
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii;
format=flowed;
delsp=yes

This script supposedly should take * out of *.domain.com, assign it to
$subdomain variable, and $subdomain should be put to AssignUserId.

However, no matter how hard I try, I can't get this to work. I've been
working on this for days, and am really desperate. If you think this
is a lot of work, please charge me consultancy and come get the root
passwd.

Any ideas though? Thanks...

<Perl>
Use Apache2::ServerRec qw//;
use Apache2::ServerUtil qw//;
use Apache2::RequestRec qw//;
use Apache2::RequestUtil qw//;
use Apache2::Const qw/OK DECLINED/;

my $s = Apache2::ServerUtil->server;

$s->push_handlers(PerlHeaderParserHandler => sub { my($r) = [at] _;
if ( $r->hostname =~ m/(.*)\.([^.]+\.\w+)$/ ) {
my($subdomain,$domain) = ($1,$2);

#
# THIS WORKS!
# -----------
# if requested domain is fio.domain.com,
# this successfully assigns ServerAdmin fio [at] domain.com
# so gathering domain parts working

$r->server->server_admin("$subdomain\ [at] $domain");

#
# THIS DOESN'T!
# --------------
# this is supposed to insert this line inside Virtual host
# --------------
# <IfModule mpm_itk_module> AssignUserId fio domain</IfModule>
# --------------

$r->add_config([ "<IfModule mpm_itk_module>",
"AssignUserId $subdomain $domain",
"</IfModule>",
]);

if ( $ [at] ) { warn $ [at] }


return OK;

} else {
return DECLINED;
}
});
</Perl>


--Apple-Mail-7--696646639
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
charset=us-ascii

<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><p>This script supposedly should take * out of *.domain.com, assign it to $subdomain variable, and $subdomain should be put to AssignUserId.</p><p>However, no matter how hard I try, I can't get this to work. I've been working on this for days, and am really desperate. If you think this is a lot of work, please charge me consultancy and come get the root passwd.</p><p>Any ideas though? Thanks...</p><pre><code><Perl>
Use Apache2::ServerRec qw//;
use Apache2::ServerUtil qw//;
use Apache2::RequestRec qw//;
use Apache2::RequestUtil qw//;
use Apache2::Const qw/OK DECLINED/;

my $s = Apache2::ServerUtil->server;

$s->push_handlers(PerlHeaderParserHandler => sub { my($r) = [at] _;
if ( $r->hostname =~ m/(.*)\.([^.]+\.\w+)$/ ) {
my($subdomain,$domain) = ($1,$2);

#
# THIS WORKS!
# -----------
# if requested domain is fio.domain.com,
# this successfully assigns ServerAdmin fio [at] domain.com
# so gathering domain parts working

$r->server->server_admin("$subdomain\ [at] $domain");

#
# THIS DOESN'T!
# --------------
# this is supposed to insert this line inside Virtual host
# --------------
# <IfModule mpm_itk_module> AssignUserId fio domain</IfModule>
# --------------

$r->add_config([ "<IfModule mpm_itk_module>",
"AssignUserId $subdomain $domain",
"</IfModule>",
]);

if ( $ [at] ) { warn $ [at] }


return OK;

} else {
return DECLINED;
}
});
</Perl></code></pre><div><font class="Apple-style-span" face="monospace"><span class="Apple-style-span" style="white-space: pre;"><br></span></font></div></body></html>
--Apple-Mail-7--696646639--
Devrim Yasar [ Mo, 23 November 2009 00:01 ] [ ID #2023666 ]
Webserver » gmane.comp.apache.mod-perl » Changing apache config with mod_perl, doesnt work!

Vorheriges Thema: Changing apache config with mod_perl, doesnt work!
Nächstes Thema: 'make test' Failure