Hey folks, I'm trying to learn how to use mod_perl to change document_root on
the fly, but I'm having a lot of difficulty with it.  Here's the setup:

Apache/2.0.50, mod_perl/1.99_11 Perl/v5.8.4 PHP/4.3.8 Server

I'm calling the code this way:

PerlTransHandler  MyApache::RewriteURI

...and this is what RewriteURI looks like (yes, wholly ripped off from the
documentation...):

###################################
package MyApache::RewriteURI;

use strict;
use warnings;

use Apache::RequestRec;
use Apache::RequestUtil;

use Apache::Const -compile => qw(DECLINED);

sub handler {
    my $r = shift;

    $r->document_root("/home/ddellacosta/web_dev/stuff/htdocs");

    warn "DOCUMENT_ROOT = " . $r->document_root() . "\n";

    $r->uri("forgot.phtml");

    return Apache::DECLINED;
}

1;
###################################


When I try to run this, I get an Internal Server Error and this message in the
error_log:

Usage: Apache::RequestRec::document_root(r) at
/usr/lib/apache2/lib/perl/MyApache/RewriteURI.pm line 14.\n

Floating around on the web are dozens of examples of being able to set
document_root the way I'm trying to set it.  However, I cannot seem to get this
to work.  Am I doing something ridiculously obviously wrong?  I am a mod_perl
newbie.

Thanks for any help!

Dave D.




-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to