Hi all,

thank you so much for you help

I will try to use other solutions a part from mod_perl
(mod_vhost_alias for example)

but I managed to do quite what I want by this way:


package My::Trans;
use Apache2::Const -compile => qw(OK DECLINED);
use DBI;
use Data:umper;
sub handler {
my $r = shift;
my $url = $r->uri();
my $rlog = $r->log;
my $db_name = 'xxx';
my $db_host = 'xxx';
my $db_port = 'xxx';
my $db_user = 'xxx';
my $db_pw = 'xxx';
my $dsn = "DBI:mysql:database=$db_name;host=$db_host;port=$db _port";
our $dbh = DBI->connect($dsn, $db_user, $db_pw);
my $hostname = $r->hostname();
my $sql = "select vpath from vhosts where vhost = '$hostname'";
my $sth = $dbh->prepare($sql);
$sth->execute;
$row=$sth->fetchrow_hashref;
$sth->finish;
$r->document_root($row->{vpath});
$r->filename($row->{vpath}.'index.html');
return Apache2::Const::OK;
}


PerlModule ModPerl::Registry
PerlTransHandler My::Trans


It seems to work fine, Apache is serving me the right page.
I'm on the right way?
Another question:
I set both document_root and filename: can I set just only the
filename or the document-root or I have to set both them?

Valerio

2008/3/28, Perrin Harkins :
> On Fri, Mar 28, 2008 at 11:36 AM, Ryan Gies wrote:
> > I'm curious, how would this be possible with mod_perl?

>
>
> I'd probably use mod_vhost_alias and make a mod_perl handler that just
> checks whether the current IP or hostname is legit.
>
>
> - Perrin
>