Hi,

I am using the following in my .htaccess file:

<Perl>
my $r = Apache->request();
$RewriteBase = $r->uri();
</Perl>

The reason for doing this is that Apache mod_rewrite requests
RewriteBase to be set to the logical path of the directory. (This code
snippet is just a test... I intend to manipulate $r->uri() so that the
filename is removed.

Anyway, when I try to access a file in this directory, I get the
following error in my log (sometimes):
Can't call method uri" on an undefined value

I say "(sometimes)" because, sometimes it does actually work!
Generally a few requests will work, then some won't. Then some will
then some won't. If I restart the Apache server they won't work until
after a few requests.

What's going on?

Also, when I flesh it out further:
<Perl>
my $r = Apache->request();
my $filenameLength = length ( $r->filename() );
my $dir = $r->uri();
for (i=0, i++; i < filenameLength) chop $dir;
$RewriteBase = $dir;
</Perl>

I get NULL being assigned to RewriteBase :-(

Any suggestions gratefully received. I've never used mod_perl before (except in CGI compatibility mode).
--
Mustafa Arif
Engineering student (ISE 4)
Imperial College, University of London
http://www.doc.ic.ac.uk/~ma499/

Blatant plug: http://live.cgcu.net/

Reply via email to