Dan McGuirk wrote:
> Hi,
> 
> I'm writing a filter using modperl-2.0, and trying to figure out how to
> get per-directory configuration information passed into it.  I've tried
> both PerlSetVar and PerlSetEnv, but nothing seems to be getting
> through.  Below is a section of the httpd.conf and the code.
> 
> The attempt to reference dir_config gives:
> 
> Can't locate object method "dir_config" via package "Apache::Filter"
> (perhaps you forgot to load "Apache::Filter"?) at {path}/RewriteLinks.pm
> line 117. 
> 
> The environment variable has no value.
> 
> Thanks for any help you can provide.
> 
> 
> <Location /filtered> 
>   PerlOutputFilterHandler RewriteLinks 
>   PerlOptions +SetupEnv 
>   PerlSetVar CurrentDirectory /foobie 
>   PerlSetEnv SomeVar SomeValue 
> </Location> 
> 
> sub handler { 
>     my $filter = shift; 
>  
> #    $filter->print("<!-- current directory: " .
> $filter->dir_config->get("CurrentDirectory") . " --\
> 
>>\n"); 
> 
>     $filter->print("<!-- SomeVar is " . $ENV{'SomeVar'} . "-->\n"); 
> }

dir_config is an Apache::RequestRec method, you need to do:

$filter->r->dir_config->get("CurrentDirectory");

you may need to require Apache::RequestUtil if it wasn't loaded yet.

As of this moment the tests in t/ are your best source for figuring out 
how to do things with new features.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to