Beberle wrote:

Ok, I've read the documentation and searched the
archives for a similar problem but no luck.  If anyone
has any suggestions, I'd be most grateful.

Here's my situation:

I've got Apache 2.0.46 with mod_perl 1.99_09 (called 2.0-tobe in the documentation) both of which were
installed by the Red Hat Enterprise installation.


I copied this startup file form the mod_perl docs:

#!/usr/bin/perl
# File: startup.pl use Apache2 ();
use lib '/etc/httpd/lib/perl';


use ModPerl::Util (); #for CORE::GLOBAL::exit
use Apache::compat ();
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();

# commented this out because Apache::ServerRec # doesn't exist on the server and throws errors

#use Apache::ServerRec ();

use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();
use APR::Table ();
use ModPerl::Registry ();
use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';
use CGI qw(-compile :all);

1;
-----------------------------------

In my perl.conf file, I've added the following lines:

LoadModule perl_module modules/mod_perl.so
PerlRequire conf/startup.pl

# this is a test module
PerlTransHandler Apache::DefaultTrans --------------------------------------


In my test module (modified from the O'Reilly "Writing
Apache Modules" book),  I have the following code:

package Apache::DefaultTrans;
# File: Apache/DefaultTrans.pm

use Apache::Const qw(:common);
use Apache::RequestIO ();
use Apache::RequestRec ();
use Apache::Log ();
use Apache::Directive ();

sub handler {
       my $r = shift;
       my $uri = $r->uri;

       my $tree = Apache::Directive::conftree();
       my $document_root =
$tree->lookup('DocumentRoot');

       $r->filename($document_root  . $r->uri);
}
---------------------------------

This throws the following error:

[error] [client 10.1.0.28]  Usage:
Apache::Directive::conf tree(CLASS)  at
/etc/httpd/lib/perl/Apache/DefaultTrans.pm

I've looked up this function in the documentation and
this seems to be the right way to use it.  Oddly, if I
try to stuff some random variable in, like:

my $tree = Apache::Directive::conftree($tree);

the error goes away, but $tree is empty.

Any help is appreciated. Thanks.




__________________________________ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com






your version is out-dated you'll have to upgrade your mod_perl and apache
nowadays we are at apache-2.52 and mp-1.99_17
http://perl.apache.org/docs/2.0/api/Apache/Directive.html#C_conftree_
The method you try to use is part of mp-1.99_12 take a look at the since information.


Tom

--
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