perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Devrim Yasar <dev...@kodingen.com>
Subject Changing apache config with mod_perl, doesnt work!
Date Sun, 22 Nov 2009 23:01:51 GMT
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) = @_;
  if ( $r->hostname =~ m/(.*)\.([^.]+\.\w+)$/ ) {
  my($subdomain,$domain) = ($1,$2);

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

  $r->server->server_admin("$subdomain\@$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 ( $@ ) { warn $@ }


  return OK;

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


Mime
View raw message