perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@ectoplasm.org>
Subject Re: Perl section and request object
Date Thu, 20 Sep 2007 07:02:49 GMT
antoine7 wrote:
> I've an SVN server on the same machine, at each commit the svn server update
> the changes to a local directory /www with this structure
> 
> [...]
> 
> I've all working, except I don't know what Host is asked by the developper
> on the apache server,

You mean, $r->hostname ?
<http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_hostname_>

> so I can't calculate a DocumentRoot to serve him the
> correct pages 
> 
> I've also try with VirtualDocumentRoot with no success, I'm an SEO Project
> Architect I well known some languages but not a perl and I'm not an Apache
> expert ... 

What you probably want to do is to implement your own MapToStorage handler
<http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlMapToStorageHandler>

It's not very hard, as all you need to do is to implement your own scheme
to map a servername+uri into a path on disk.

sub handler {
	my $r = shirt;
	my $host = $r->hostname;
        my $uri = $r->uri;

	[... figure out if you care about this particular request ...]
	[... otherwise, let apache do what it normally does ...]
        return Apache2::Const::DECLINED unless $care;

        [... from $host + $uri, figure out where this should end up ...]
        $r->filename("/some/calculated/path");

	return Apache2::Const::OK;
}

> There's the solution to read the /www directory and generate dynamicly some
> VHost but the server will have to be restarted each time a directory is
> added to /www ... it's not a good option in my point of view

There are always graceful restarts to deal with that.
------------------------------------------------------------------------
Philippe M. Chiasson     GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/       m/gozer\@(apache|cpan|ectoplasm)\.org/


Mime
View raw message