tomgracey has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks
I am messing around creating some kind of basic proxy system using a mod_perl handler. I have some code like this:
package My::Handler; use strict; use warnings; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Const -compile => qw(OK); use LWP::UserAgent (); sub handler{ my ($r) = @_; my $ua = LWP::UserAgent->new; my $resp = $ua->get( $r->unparsed_uri ); $r->print( $resp->decoded_content ); return Apache2::Const::OK; }
and in my apache config:
<Perl> use lib "/my/handler/lib"; </Perl> PerlModule My::Handler <Location /> Require all granted SetHandler perl-script PerlResponseHandler My::Handler </Location>
However, when I run it I seem to get
Can't locate HTTP/Config.pm: /my/handler/lib/HTTP/Config.pm: Permiss +ion denied at /<perlbrew path>/perl-5.34.0/lib/site_perl/5.34.0/LWP/U +serAgent.pm line 865.
If I add use HTTP::Config under use LWP::UserAgent at the top, it then complains about another missing module. It seems to be expecting to find these modules in /my/handler/lib, even though when I dump @INC this appears to contain all the perlbrew paths to the perl version (v34.0) I am using as expected. I tried copying verbatim a handler from the mod perl docs but with the same result. I am guessing therefore the problem is something to do with my setup and/or apache setup - but what? Any thoughts/suggestions would be helpful. Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: module not found errors in a mod_perl handler
by hippo (Archbishop) on Dec 15, 2022 at 18:58 UTC | |
by tomgracey (Scribe) on Dec 15, 2022 at 19:18 UTC | |
by hippo (Archbishop) on Dec 15, 2022 at 21:23 UTC |