I'm trying to setup HTML::Mason on an apache+mod_perl server.

When I put PerlModule HTML::Mason::ApacheHandler into my apache httpd.conf, I get the following error:

$ apachectl start Syntax error on line 1024 of /home/andrew/apache/conf/httpd.conf: unknown field passed to constructor for class HTML::Mason::ExceptionCompilation fai +led in require at (eval 4) line 3. /home/andrew/apache/bin/apachectl start: httpd could not be started

Any ideas where to start looking/debugging this one?


Update: PerlModule just loads HTML::Mason::ApacheHandler at server launch. If you do not set it, and just put the following in httpd.conf as follows:

SetHandler perl-script PerlHandler HTML::Mason::ApacheHandler

Without calling PerlModule first, it simply requires it ever time a request is processed at runtime.

In this instance, even when I do it that way it still fails with a similiar error, when it trys to load HTML::Mason::ApacheHandler:

[Mon Aug 1 10:01:09 2005] [error] unknown field \n passed to construc +tor for class HTML::Mason::ExceptionCompilation failed in require at +(eval 5) line 3.\n [Mon Aug 1 10:01:09 2005] [error] Can't locate object method "make_ah +" via package "Apache" (perhaps you forgot to load "Apache"?) at (eva +l 31) line 6.\n


Update 2: When I simply try to:

$ perl -MHTML::Mason::ApacheHandler -e '' Undefined subroutine &Apache::perl_hook called at /home/andrew/cpan/li +b/HTML/Mason/ApacheHandler.pm line 356. BEGIN failed--compilation aborted at /home/andrew/cpan/lib/HTML/Mason/ +ApacheHandler.pm line 356. Compilation failed in require. BEGIN failed--compilation aborted.

I am not sure if this is the same problem.

In any case PerlModule HTML::Mason::ApacheHandler should work. See Mason basic config via httpd.conf


Could it have to do with me recently installing and then uninstalling Perl 5.8.7 in my home directory even though the system wide configuration is 5.6.1? Longshot.

Could it have something to do with me compiling mod_perl as a DSO and not having it statically linked? Another longshot.

HTML::Mason::CGIHandler works fine.

Apache::Registry also works fine.

HTML::Mason::ApacheHandler always fails with the above weird 'unknown field' error.


Solved! You need to enabled PerlMethodHandlers when you build mod_perl. PerlMethodHandlers allow object-oriented style inheritance of apache handlers between Perl objects. HTML::Mason::ApacheHandler uses this feature.

It could have given a nicer error message than "unknown field" though.

Especially seeing as PerlMethodHandlers are disabled by default.

-Andrew.


Andrew Tomazos  |  andrew@tomazos.com  |  www.tomazos.com

In reply to Weird HTML::Mason error by tomazos

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.