######## Perl stuff
#
# perl.conf
#
# The following are mod_perl related things
#
#using Linux instead of win change .dll to .so
LoadFile /usr/local/perl/bin/perl58.dll
LoadModule perl_module modules/mod_perl.so
LoadFile bin/libapreq2.dll
LoadModule apreq_module modules/mod_apreq.so
SetEnv PERLLIB /usr/local/perl/lib;/usr/local/perl/site/lib
SetEnv PERL5LIB /usr/local/perl/lib;/usr/local/perl/site/lib
# If you want CGI outside ScriptAliased directories, uncomment the following lines.
#
#AddHandler cgi-script .cgi .pl
# The following is for mod_perl
include conf/mod_perl.conf
# The following is for HTML::Mason with mod_perl
include conf/mason-mod_perl.conf
#
#
##### End of Perl stuff
----->snip<-----------
####
#
# mod_perl.conf for apache
PerlRequire conf/startup-mod_perl.pl
# Change path if not all right!
Alias /perl/ /usr/local/apache/perl/
#
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +execCGI
--------
#
# Config Mason with mod_perl
PerlRequire conf/mason-handler.pl
# Change path if not all right!
Alias /mason/ /usr/local/apache/mason/
SetHandler perl-script
PerlHandler HTML::Mason
--------
#### startup-mod_perl.pl
##
## StartUp file for mod_perl
##
use Apache2 ();
# change inc paths if
use lib qw (
/usr/local/apache/perl
/usr/local/perl/lib
/usr/local/perl/site/lib
);
#for mod_perl_1 compatibility
use Apache::compat ();
use ModPerl::Util (); #for CORE::GLOBAL::exit
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();
use Apache::Session ();
use Apache::ServerRec ();
use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();
use APR::Table ();
use ModPerl::Registry ();
use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';
use CGI ();
1;
----------------------------
#
# A basic, functional Mason handler.pl.
#
package HTML::Mason;
#
# Setup for mod_perl 2
use Apache2 ();
use lib qw(
/usr/local/apache/mason
/usr/local/perl/site/lib
/usr/local/perl/lib
);
use Apache::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 $comproot = "/usr/local/apache/mason";
my $datadir = "/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!
$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',
);
}
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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;
my $status = $ah->handle_request($r);
return $status;
}
1;