SPUG: mode_perl
Alan
alan at ufies.org
Fri Oct 31 15:43:22 CST 2003
On Thu, Oct 30, 2003 at 03:27:19PM -0800, Luis Medrano wrote:
> List,
>
> Question,
>
> I have a web server with multiple domains and I trying to do the following using mode_perl:
>
> http://domain1.com/perl
>
> pull a web page and add the word perl which is on the url or if I have http://domain.com/linux put the word linux on the webpage. My question is how I can do this?..
If I remember right, you use something like this:
# Have apache put the /words url under control of the My::Words perl
# module.
<Location /words>
SetHandler perl-script
PerlHandler My::Words
</Location>
# In the My::Words module:
sub handler {
my $r = shift;
# send the page headers
$r->content_type('text/html');
$r->send_http_header;
# get the path that is passed to this module
my $words = $r->path_info();
$r->print($words);
}
Basically if you have /words under the control of mod_perl, when you go
to the url of http://server.com/words/perl, everything past /words can
be retrieved with the path_info() function, and then you can do whatever
you want with it.
Note the above code should work, but hasn't been tested.
alan
--
Alan <alan at ufies.org> - http://arcterex.net
--------------------------------------------------------------------
"There are only 3 real sports: bull-fighting, car racing and mountain
climbing. All the others are mere games." -- Hemingway
More information about the spug-list
mailing list