Thank you for pointing out all that relevant aspects.

I'll go on with the second method.


On Mon, Nov 19, 2012 at 11:22 PM, André Warnier <> wrote:
Samuel Gómez wrote:

In a mod_perl handler I am writing I wrote
my $parsed_uri = APR::URI->parse($r->pool, $uri);
as stated by
but on execution it gave me this error:
"Usage: APR::URI::parse(classname, p_sv, uri)"

So I have three questions.

1. I think there is an error regarding the APR::URI->parse method either in
the mod_perl documentation, or in mod_perl itself.

2. If mod_perl is right, what is a classname? Please provide an example.

3. Actually I was using that line to get the hostname of the request. I
replaced it by
my $uri_hostname = $r->hostname;
and it is apparently working. I'm I doing it right?


I don't know about the first problem you mention.
But the APR::URI module is for manipulating URI's in general.  Any URI.

If all you want is the target hostname of the current request, then your second method (in (3)) is easier, probably much faster, and does not force you to load the APR::URI module.