Subject: | HTML-Mason does not work with mod_perl mod_perl/1.999.24 |
HTML-Mason cannot be run with mod_perl mod_perl/1.999.24.
HTML-Mason 1.28 from TheoryX5
Perl is:
This is perl, v5.8.6 built for MSWin32-x86-multi-thread
(with 3 registered patches, see perl -V for more detail)
Copyright 1987-2004, Larry Wall
Binary build 811 provided by ActiveState Corp. http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Dec 13 2004 09:52:01
Attached: masonhandler for mod_perl (mh.pl)
#!/usr/bin/perl
#
# A basic, functional Mason handler.pl.
#
package MyApp::Mason;
use lib qw(
X:/usr/local/perl/site/lib
X:/usr/local/perl/lib
);
use strict;
use Apache2::compat ();
# Preload CGI since we are using it for mod_perl 2
use CGI ();
# Bring in Mason with Apache support.
use HTML::Mason::ApacheHandler ();
# List of modules that you want to use within components.
{
package HTML::Mason::Commands;
use Data::Dumper;
}
# Create Mason objects
my $ah = 0;
my $old_mason_syntax = 1;
my $comproot = "X:/usr/local/apache/mason";
my $datadir = "X:/usr/local/apache/tmp/mason";
if ($HTML::Mason::VERSION < 1.18) { # Mason < 1.18
my $parser = new HTML::Mason::Parser;
my $interp = new HTML::Mason::Interp (
parser => $parser,
comp_root => $comproot,
data_dir => $datadir,
#error_mode => 'fatal', # Output to serverlog
error_mode => 'output',
#
#This may be brief , text , line , or html .
#These produce an error message with no trace,
#a multiline error with trace information,
#a single-line error with tab-separated fields (suitable for writing to a log),
#and a fancy HTML format.
error_format => 'html',
);
$ah = new HTML::Mason::ApacheHandler ( interp=>$interp );
}
else { # ab Mason >= 1.18!
if ($old_mason_syntax) {
#--- mit Standard-Mason-Syntax
$ah = new HTML::Mason::ApacheHandler (
comp_root=>$comproot,
data_dir=>$datadir,
#error_mode => 'fatal', # Output to serverlog
error_mode => 'output',
#
#This may be brief , text , line , or html .
#These produce an error message with no trace,
#a multiline error with trace information,
#a single-line error with tab-separated fields (suitable for writing to a log),
#and a fancy HTML format.
error_format => 'html',
);
}
else {
#+++ mit neuer ASP/JSP-ähnlicher Syntax
$ah = new HTML::Mason::ApacheHandler (
comp_root=>$comproot,
data_dir=>$datadir,
lexer_class =>'MasonX::Lexer::MSP',
#error_mode => 'fatal', # Output to serverlog
error_mode => 'output',
#
#This may be brief , text , line , or html .
#These produce an error message with no trace,
#a multiline error with trace information,
#a single-line error with tab-separated fields (suitable for writing to a log),
#and a fancy HTML format.
error_format => 'html',
);
}
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Activate the following if running httpd as root (the normal case).
# Resets ownership of all files created by Mason at startup.
#
#chown (Apache->server->uid, Apache->server->gid, $interp->files_written);
sub handler {
my ( $r ) = @_;
# If you plan to intermix images in the same directory as
# components, activate the following to prevent Mason from
# evaluating image files as components.
#
return -1 if $r->content_type && $r->content_type !~ m|^text/|i;
return $ah->handle_request( $r );
}
1;