in reply to Re^2: Dynamic @INC under mod_perl2 (Apache2 VirtualHost)
in thread Dynamic @INC under mod_perl2 (Apache2 VirtualHost)

Thank you - I am making progress.

I've setup Apache to listen on port 8080 and Included VH config file like so:

<VirtualHost *:8080> ServerName test.graq.co.uk DocumentRoot /home/graq/html/ PerlOptions +Parent PerlSwitches -I/home/graq/lib -I/home/graq/test-lib ScriptAlias /cgi-events /home/graq/cgi-bin ErrorLog /var/log/httpd/graq8080_error_log CustomLog /var/log/httpd/graq8080_access_log combined SetEnv PERL5LIB /home/graq/lib:/home/graq/test-lib Include "/etc/httpd/conf/dev8080/graq.conf" Include "/etc/httpd/conf/dev8080/other.conf" </VirtualHost>
The config file dev8080/graq.conf contains the mod_perl handler definitions:
... PerlModule GRAQ::Menu; ... <Location /_menu> SetHandler modperl PerlOptions +ParseHeaders PerlOptions +SetupEnv PerlResponseHandler GRAQ::Menu </Location> ...
And here is the snippet from GRAQ::Menu
package GRAQ::Menu; use Apache2::Const; use Apache2::RequestRec (); use Apache2::RequestUtil (); sub handler { my ($r) = @_; # my $r = Apache2::RequestUtil->request(); $r->log_error( 'GRAQ::Menu::handler: START'); ... }
Which I have as an alternative tried to setup as an Apache2::Filter.
package GRAQ::Menu; use base qw(Apache2::Filter) ... sub handler :FilterRequestHandler() { my ($f) = @_; my $r = $f->r; ... }
UPDATE To clarify further, the dev8080/other.conf config file has this definition:
<IfDefine MODPERL2> PerlOptions +GlobalRequest </IfDefine>
/UPDATE
But I get this error, despite my best efforts:
Can't locate object method "log_error" via package "Apache2::RequestRe +c" at /home/graq/lib/GRAQ/Menu.pm line 56.

This all used to work with liberal smatterings of <Perl> use lib 'home/graq/lib';</Perl> and I'm getting a little lost on exactly what effects my changes have had on the mod_perl environment.

I remember having this error when porting from mp1 to mp2, but can't find any notes on it or hints from the docs on what object I should have in handler...?

-=( Graq )=-

Replies are listed 'Best First'.
Re^4: Dynamic @INC under mod_perl2 (Apache2 VirtualHost)
by graq (Curate) on Mar 29, 2006 at 10:48 UTC
    Looking through the Apache2::RequestRec documentation shows that log_error actually exists on Apache2::Log (which extends Apache2::RequestRec).

    For whatever reason, that extension was not loaded with the new configuration. Adding use Apache2::Log; to my modules fixed the problem.

    Thank you all for your help

    -=( Graq )=-