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!


In reply to module not found errors in a mod_perl handler by tomgracey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.