I am happy to announce the availability of several Mason add-on modules that enable Mason to run in a pure mod_perl2 ( using the "mod_perl" not "CGI" request interface ).
I would like to submit these modules to CPAN to insure greater availability. Your comments would be appreciated. These modules are: HTML::Mason::ApacheHandler2 v 0.01 MasonX::Request::WithApacheSession2 v 0.01 They require: perl => 5.8.0 mod_perl => 1.9910 HTML::Mason => 1.25 libapreq2 => 2.02-dev They are EXPERIMENTAL and should NOT BE RUN IN A PRODUCTION ENVIRONMENT. They are Not yet on CPAN, but are available on my site: <http://beaucox.com/mason> Please direct comments, bug reports, etc to me at: <[EMAIL PROTECTED]> Here is a portion of the HOWTO: NAME HTML::Mason::ApacheHandler2 - experimental (alpha) Mason/mod_perl2 interface SYNOPSIS use HTML::Mason::ApacheHandler2; my $ah = HTML::Mason::ApacheHandler2->new (..name/value params..); ... sub handler { my $r = shift; $ah->handle_request($r); } DESCRIPTION HTML::Mason::ApacheHandler2 is highly experimental ( alpha ) and should only be used in a test environment. HTML::Mason::ApacheHandler2 was written to allow Mason to run in a 'pure' mod_perl2/Apache2 environment using the mod_perl2 native request structure as implemented by libapreq2. As such, this module is highly experimental and definitely not-ready-for-prime-time. This is an unofficial release, not supported by the Mason group. If you want to use this module in a testing environment, please address problems, issues, comments, and improvements to me, not Mason. When deciding to port Mason to mod_perl2 I took the approach to add Module(s) rather than patching core Mason modules. Upon investigation I discovered that all the Apache 'glue' code in Mason was contained in HTML::Mason::ApacheHandler. Therefore, I renamed and modified that module to create HTML::Mason::ApacheHandler2. The actual changes I made can be found in the distribution in diff/ApacheHandler.diff ( made with 'diff -Naru' ... ). As a result of my approach, you may install the normal Mason ( >= 1.25 ), the modules in "PREREQUISITES" below, and this module. After configuring ( see "CONFIGURATION" below ), you're ready to play. The ApacheHandler2 object links Mason to mod_perl2, running components in response to HTTP requests. It is controlled primarily through parameters to the new() constructor. handle_request() is not a user method, but rather is called from the HTML::Mason::handler() routine in handler.pl. HTML::Mason::ApacheHandler2 is a modified copy of the standard HTML::Mason::ApacheHandler. ApacheHandler2 MUST be used with mod_perl2. You may, however, run Mason with Apache2/mod_perl2 without ApacheHandler2 (see my rather dated mini-HOWTO at <http://beaucox.com/mason/mason-with-apmp2-mini-HOWTO.htm>), but you then use use 'CGI' requests rather than the native 'mod_perl' requests. The interface is the same as ApacheHandler's, Please refer to HTML::Mason, HTML::Mason::ApacheHandler, and <http://masonhq.com/docs/manual/Admin.html>. PREREQUISITES You must have the following packages installed: perl => 5.8.0 mod_perl => 1.9910 HTML::Mason => 1.25 libapreq2 => 2.02-dev Please refer to the packages' documentation for instructions. WARNING: PERL 5.8.2 If you are using perl 5.8.2 you may get a series of errors in the http/error_log such as: Attempt to free unreferenced scalar: SV 0x405e6e78 at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 160. ... [Fri Jan 30 09:41:58 2004] [error] [client 207.175.219.202] Attempt to free unreferenced scalar: SV 0x405e6e78 at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/ Apache/Cookie.pm line 67. Stack: [/usr/lib/perl5/site_perl/5.8.2/HTML/Mason/ApacheHandler2.pm:892] [/usr/lib/perl5/site_perl/5.8.2/HTML/Mason/ApacheHandler2.pm:801] [/srv/www/perl/MyApache/Mason/ApacheHandler2.pm:86] [-e:0] which may return a 500 Internal Server Error to the user. There was a bug introduced in perl 5.8.2 and fixed in 5.8.3, which affects some XS modules running under a threaded mpm mod_perl 2.0 (or any ithreads perl application). The affected modules can be fixed, to avoid this problem, by using the PERL_NO_GET_CONTEXT macro in the XS code (see the perlguts manpage for more information). So you need to check whether a newer version of the module is available. If not you need to upgrade to perl 5.8.3 or higher and the problem will go away. When I had these problems, I ended up upgrading to 5.8.3 and recompiling EVERY CPAN module I use and remaking mod_perl2. You may have to do the same thing. I don't know if there are similar problems in 5.8.0 or 5.8.1, but I gather the problem is mainly manifested in 5.8.2. CONFIGURATION ApacheHandler2 provides a way for Mason to use the pure mod_perl2 request interface (libapreq2). THIS MODULE IS EXPERIMENTAL. PLEASE USE FOR TESTING ONLY UNTIL IT HAS PASSED THE TEST OF TIME. Having given that dire warning, I have been using it on my personal site and one of the sites I administer since mid January, 2004. It _seems_ to work fine. ... Aloha => Beau; -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html