* Worik Stanton <[email protected]> wrote:
> Date: Thu, 19 Jun 2014 12:13:10 +1200
> From: Worik Stanton <[email protected]>
> To: mod_perl list <[email protected]>
> Subject: $r->path_info unreliable?
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101
> Thunderbird/24.5.0
>
> In my handler I call $r->path_info to determine the path used to call my
> script.
It looks to me, on the face of it, that you should use "$r->uri" instead.
$r->path_info() should return nothing if there is no such a file in the
local file system that corresponds to that name.
Regards,
Jie
> I am trying to have a test version of my code using the same module but
> which reads different data based on the path.
>
> So I have:
>
>
> <Location /MyPackage2>
> SetHandler perl-script
> PerlResponseHandler Apache::MyPackage::FrontEnd2
> </Location>
> <Location /MyPackage2Test>
> SetHandler perl-script
> PerlResponseHandler Apache::MyPackage::FrontEnd2
> </Location>
>
> In FrontEnd2....
>
>
> sub handler {
> my $r =3D shift;
> warn $r->path_info;
> if($r->path_info =3D~ /test/i){
> ## Load test data
> }else{
> ## Load real data
> }
>
> This works for another package I have exactly like this, but in this
> case $r->path_info is empty.
>
> I am stumped.
>
> Worik
> --
> The only true evil is turning people into things....
> Granny Weatherwax
> [email protected] 021-1680650, (03) 4821804
> Aotearoa (New Zealand)
>