Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Apache/mod_perl2 : "failed to resolve handler"

by jpeg (Chaplain)
on Jun 20, 2005 at 15:21 UTC ( [id://468382]=perlquestion: print w/replies, xml ) Need Help??

jpeg has asked for the wisdom of the Perl Monks concerning the following question:

Monks, I'm humbled to come to you with a typical Friday afternoon/Monday morning problem. I'm trying to move into mod_perl and was looking at modperl's docs/user/config/config.pod, which gave me the following example:

This is almost certainly a stupid configuration issue. In httpd.conf I have
....
PerlSwitches -wT
PerlSwitches -I/usr/local/apache2 -I/usr/local/apache2/pl

and later:

PerlModule pl::Hello
<Location /hello>
SetHandler modperl
PerlResponseHandler pl::Hello
</Location>

in /usr/local/apace2/pl I have Hello.pm.

So when I issue a request for http://localhost/hello I get a blank page and the error log says:
failed to resolve handler pl::Hello

I've tried changing the PerlModule and PerlResponseHandler lines to Hello (same result, even when moving Hello.pm to site_perl) and pl/Hello (different error entirely).

I have a traditional cgi that does a foreach my $i (@INC) {print $i} and /usr/local/apache2 and /usr/local/apache2/pl are not present. On the other hand, when I changed the PerlModule and PerlResponseHandler lines to refer to Hello.pm, apache barfs with this error:
error Can't locate pl::Hellopm in @INC (@INC contains:
/usr/local/apache2 /usr/local/apache2/pl /usr/lib/perl5/5.8.6/i486-linux /usr/lib/perl5/5.8.6 ...(truncated)

So what is incorrect with the above syntax? Is that not how I specify my own handlers? Am I missing some directives?
What is the difference between the modperl and perl-script SetHandler options?
Thanks for your patience.

--
jpg
  • Comment on Apache/mod_perl2 : "failed to resolve handler"

Replies are listed 'Best First'.
Re: Apache/mod_perl2 : "failed to resolve handler"
by ikegami (Patriarch) on Jun 20, 2005 at 15:40 UTC

    This is not the appropriate place for mod_perl support. Check mod_perl's Getting Help.

    I do have a quick comment and possible solution:

    I don't think "traditional CGI" pays any attention to PerlSwitches, so it's no surprise it doesn't know about the new paths.

    What's the package used in Hello.pm? It should be package pl::Hello.

      In addition to the above, try loading your module before using it as a handler. This will cause Apache to not even start if there are problems with it and thus catch your problem (with a better error message) earlier.
      PerlModule pl::Hello
      or in a startup.pl
      use pl::Hello;

      -- More people are killed every year by pigs than by sharks, which shows you how good we are at evaluating risk. -- Bruce Schneier
      Changing the package line in Hello.pm from Hello to pl::Hello fixed it. Thanks.

      For the record, I listed the differences between the CGI script's @INC path and modperl's @INC path to demonstrate that the PerlSwitches directive worked; e.g., that this was not a problem with @INC not seeing /usr/local/apache2/pl. That wasn't my question; sorry if that was unclear.

      Update:
      ikegami, can you clarify your post? Was there some specific mod_perl related link you wanted me to see? You posted a search result for 'getting help'. I don't get what you're trying to tell me.

      --
      jpg

        ikegami, can you clarify your post? Was there some specific mod_perl related link you wanted me to see? You posted a search result for 'getting help'. I don't get what you're trying to tell me.

        Here's the link to mod_perl's Getting Help that ikegami meant.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://468382]
Approved by ghenry
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-23 23:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found