Hallo all!

I'm new to mod_perl, and I see the strange behaviour of local variables in functions.
This is my simple test:


==
.htaccess:

SetHandler perl-script
PerlHandler My::Test;

==
package My::Test;
#/usr/local/apache/My/Test.pm

use strict;
use Apache::Constants ':common';

sub handler {
my $r=Apache->request;
$r->content_type('text/html');
$r->send_http_header;
print "Request: ".$r->uri."<br/>";
my $s = $r->uri;
print "From main: $s<br/>";
Call();
return OK;


sub Call {
print "From Call: $s<br/>";
print "But request: ".$r->uri;
}
}


1;
==

First time I got correct answer:
(request: GET /1111)
Request: /111
From main: /111
From Call: /111
But request: /111

But in next times I got a old $s value in the Call() function:

GET /1111/222
Request: /111/222
From main: /111/222
From Call: /111
But request: /111/222

GET /1234
Request: /1234
From main: /1234
From Call: /111
But request: /1234

Where I am wrong? Or where I can found corresponding documentation?

I beg your pardon for my english.

--
Vladimir D Belousov




Reply via email to