----- Original Message -----
From: "Alastair Stuart" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 18, 2001 3:38 PM
Subject: modperl questions


[snip]

> -- how to add new aliases to httpd.conf or ./conf/clients.pl
> without having to restart apache ??

Why not use a perl handler?
Put all the logic in perl libraries and not perl scripts.
Make 1 perl package for communicatio between apache and the perl library.
Then define a location in the apache handler once:

<Location /Client>
SetHandler perl-script
PerlHandler FOO::Client
</Location>

In the package FOO::Client make a subroutine named "handler".

use FOO::SomeApplication;

sub handler {
 my $r = shift;
 my ($command, $params) = split ("&", $r->args, 2);
 my %params = map {s/\+/ /g; s/%([0-9a-zA-Z]{2})/chr(hex($1))/eg; $_} map
{split /=|$/, $_, 2} split /&/, $r->args();
    $params = "&$params" if $params;
    my $client = substr ($r->path_info(),1);
  # do your stuff here
}

Then you can use UR's like:

https://www.foo.co.za/Client/johnson
https://www.foo.co.za/Client/Pete

The URL will not point to a file, but to a resource.
Th eclient name will be in $client in the handler shown above.

Hope this puts you in the right direction.


> second question:
>
> Now that we have multiple application and database instances
> running concurrently, how do we ensure that filehandle and
> Apache::DBI symbols are reliably encapsulated in their
> own namespsaces, all running off the same codebase ?
>

See above

You can use different perl packages for each <Location ....>
So you can use multiple applications.
You can even set HTTP authentication for each <Location...>

This way you might be able to use you existing perl packages without
migrating them.

Hope this puts you in the right direction.

Maarten.

Reply via email to