Hello all. Having just figured out Mod_Perl1 recently I've decided to try my hand at Mod_Perl2. I think I understand the changes and I've been able to get scripts to work under ModPerl::Registry, but now I'm trying to write a custom handler and I'm not having much luck.

Everytime I try to access my handler from the browser I get a blank screen. In the log I get 'failed to resolve handler: My::Handler'. Searching around I found this typically happens when Apache can't find the module, however in all the examples I found online the error message in the logs said "Unable to find Whatever.pm in @INC etc etc etc ...". I tried intentionally breaking the path to my lib and indeed I got the rest of the error message. But when the path is correct (and a test of the syntax shows its correct too) I keep getting the error. I'm not sure where else to look.

Here's the handler code:

#!/usr/bin/perl use strict; use Apache2::RequestRec (); use Apache2::Const qw(:common); sub handler { my $r = shift; $r->print("Content-Type: text/plain\n\n"); $r->print('TEST!'); return OK; } 1;

Here's my Virtualhost configuration

<VirtualHost xxx.xxx.xxx.xxx:80> ServerName myhostname.org ServerAlias www.myhostname.org ServerAdmin admin@myhostname.org DocumentRoot /home/www/vhosts/host/html ErrorLog /home/www/vhosts/host/logs/error_log CustomLog /home/www/vhosts/host/logs/access_log combined ScriptAlias /cgi-bin/ /home/www/vhosts/host/cgi-bin/ UserDir disabled PerlOptions +Parent PerlConfigRequire /home/www/vhosts/host/lib/test-startup.pl PerlModule BCS::Test <Directory /home/www/vhosts/host/html> AllowOverride AuthConfig FileInfo Options Indexes FollowSymLinks Includes MultiViews Order allow,deny Allow from all </Directory> <Directory /home/www/vhosts/host/cgi-bin> AllowOverride AuthConfig Options ExecCGI Order allow,deny Allow from all </Directory> <Location /testpl> SetHandler perl-script PerlResponseHandler BCS::Test PerlOptions +ParseHeaders Options +ExecCGI </Location> </VirtualHost>

Thanks for the help!


In reply to Mod_Perl2: Cannot resolve handler by cfreak

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.