debian/ 0000755 0000000 0000000 00000000000 12226313325 007165 5 ustar debian/libhtml-mason-perl.README.Debian 0000644 0000000 0000000 00000011540 12012527033 014730 0 ustar HTML::Mason Debian package
==========================
All Mason documentation is available [1]on the Mason website. An
introduction to Mason can be found in [2]Mason.html, and the
Administrator's Manual in [3]Admin.html.
1. http://www.masonhq.com/docs/manual/
2. http://www.masonhq.com/docs/manual/Mason.html
3. http://www.masonhq.com/docs/manual/Admin.html
Some basic Mason examples can be found in the libhtml-mason-perl-doc
package.
Using HTML::Mason with mod_perl
-------------------------------
The standard way to run Mason is with mod_perl. The references above
provide detailed information about this configuration. The following
information is extracted directly from the Administrator's Manual.
Please refer to the manual for a more detailed explanation.
The absolutely most minimal configuration looks like this:
PerlModule HTML::Mason::ApacheHandler
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
In practice, this is a bad idea, as you don't want Mason to try to
process images or other binary files, nor do you want private
(non-top-level) Mason components to be served to users. The
recommended naming scheme is to use "normal" extensions for top-level
components, adding an "m" prefix for private components.
Here is a configuration that enforces this naming scheme:
use HTML::Mason::ApacheHandler;
use Apache2::Const -compile => qw(HTTP_NOT_FOUND);
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
SetHandler perl-script
PerlInitHandler Apache2::Const::HTTP_NOT_FOUND
Using HTML::Mason with SpeedyCGI
--------------------------------
While mod_perl is definitely the standard way to run Mason, it is also
possible to run it in a CGI environment. This would be preferable, for
example, in some shared hosting environments (as mod_perl runs everything
under the same process), or when using a web server other than Apache.
Standard CGI is prohibitavely expensive, but this can be mostly
overcome by a persistent CGI framework, such as SpeedyCGI or FastCGI.
SpeedyCGI is the simpler of the two, and is recommended unless you
have other reasons to pursue FastCGI.
First, you need to install speedy-cgi-perl. (Note that it is also
possible to use libapache-mod-speedycgi, although this won't be
covered here.)
In httpd.conf, enable mod_actions and configure like this:
Action html-mason /cgi-bin/speedycgi-handler.cgi
AddHandler html-mason .html
Or equivilantly:
Action html-mason /cgi-bin/speedycgi-handler.cgi
SetHandler html-mason
Create /usr/lib/cgi-bin/speedycgi-handler.cgi like so:
====
#!/usr/bin/speedy
# -*- perl -*-
use HTML::Mason::CGIHandler;
BEGIN { warn "Loading speedycgi-handler.cgi"; };
warn "Executing speedycgi-handler.cgi";
my $h = HTML::Mason::CGIHandler->new(data_dir => "/var/cache/mason");
$h->handle_request;
====
Obviously, you can take out the "warn" lines in real use, but for
testing this will demonstrate that mason-handler.cgi itself is only
loaded once.
Remember that stopping Apache does not kill off the speedy_backend
processes!
It is also possible to run Mason via CGI entirely from .htaccess files
in your public_html directory. The instructions to do so were
contributed by a previous maintainer, Steve Haslam, in March 2004.
They may be out of date, but are provided here as a starting point for
those who are interested.
# /home/shaslam/public_html/mason_test/.htaccess:
RewriteEngine On
RewriteBase /~shaslam/mason_test/
RewriteRule ^mason_example_cgi/$ /~shaslam/mason_test/speedycgi_handler.cgi/mason_example/index.html
RewriteRule ^mason_example_cgi/(.+)/$ /~shaslam/mason_test/speedycgi_handler.cgi/mason_example/$1/index.html
RewriteRule ^mason_example_cgi/(.+) /~shaslam/mason_test/speedycgi_handler.cgi/mason_example/$1
Options +ExecCGI
AddHandler cgi-script .cgi
And speedycgi_handler.cgi must specify 'comp_root =>
"/home/shaslam/public_html/mason_test"' when constructing the
CGIHandler object.
The fiddling to rewrite requests to /index.html is not necessary if
your URIs really do map to the mason components, because then mod_dir
will do it. OTOH, you need to avoid rewriting requests ending in / in
that case. Something like:
RewriteRule ^mason_example_cgi/(.*[^/]) /~shaslam/mason_test/speedycgi_handler.cgi/mason_example/$1
And then, assuming "mason_example_cgi" is a directory with the
components under it, requests ending in "/" will *not* be rewritten,
so mod_dir will pick them up and look for "index.html" (DirectoryIndex
setting) locations as usual.
In general, this fiddling is not fun for novices.
-- Charles Fry , Fri, 17 Jun 2005 01:21:57 -0400
debian/patches/ 0000755 0000000 0000000 00000000000 12150174777 010630 5 ustar debian/patches/02_cgihandler.patch 0000644 0000000 0000000 00000001017 12150174772 014244 0 ustar Description: mimic mod_perl behaviour in HTML::Mason::CGIHandler
Origin: vendor
Last-Update: 2011-07-09
--- a/lib/HTML/Mason/CGIHandler.pm
+++ b/lib/HTML/Mason/CGIHandler.pm
@@ -97,6 +97,9 @@
$sent_headers = 1;
}
+ # mimic mod_perl behaviour
+ use bytes;
+
# We could perhaps install a new, faster out_method here that
# wouldn't have to keep checking whether headers have been
# sent and what the $r->method is. That would require
debian/patches/series 0000644 0000000 0000000 00000000053 12012523403 012020 0 ustar 01_apachehandler.patch
02_cgihandler.patch
debian/patches/01_apachehandler.patch 0000644 0000000 0000000 00000003070 12150174777 014730 0 ustar Description: fix $VERSION handling; use /var/cache/mason as default data_dir
Origin: vendor
Last-Update: 2011-07-09
--- a/lib/HTML/Mason/ApacheHandler.pm
+++ b/lib/HTML/Mason/ApacheHandler.pm
@@ -9,9 +9,6 @@
package HTML::Mason::ApacheHandler;
-use vars qw($VERSION);
-# do not change the version number
-$VERSION = 1.69;
# PerlAddVar was introduced in mod_perl-1.24
@@ -27,7 +24,7 @@
require mod_perl;
}
- my $mpver = (mod_perl2->VERSION || mod_perl->VERSION || 0);
+ my $mpver = ($mod_perl2::VERSION || $mod_perl::VERSION || 0);
# This is the version that introduced PerlAddVar
if ($mpver && $mpver < 1.24)
@@ -270,6 +267,11 @@
unless Apache::perl_hook('TableApi');
}
+# CFRY: moved down from top of file in Debian (by a previous maintainer)
+use vars qw($VERSION);
+# do not change the version number
+$VERSION = 1.69;
+
use base qw(HTML::Mason::Handler);
BEGIN
@@ -598,7 +600,11 @@
if (exists $allowed_params->{data_dir} and not exists $params{data_dir})
{
# constructs path to /mason
- if (UNIVERSAL::can('Apache2::ServerUtil','server_root')) {
+ # CFRY: use /var/cache/mason as default data_dir on Debian
+ if (-d '/var/cache/mason') {
+ $defaults{data_dir} = '/var/cache/mason';
+ }
+ elsif (UNIVERSAL::can('Apache2::ServerUtil','server_root')) {
$defaults{data_dir} = File::Spec->catdir(Apache2::ServerUtil::server_root(),'mason');
} else {
$defaults{data_dir} = Apache->server_root_relative('mason');
debian/mason_example/ 0000755 0000000 0000000 00000000000 11671745124 012026 5 ustar debian/mason_example/show-cookies.html 0000644 0000000 0000000 00000002117 11671745124 015327 0 ustar <%doc>
This is actually more complicated than it needs to be.
You could simply say:
$cookies = UNIVERSAL::can("Apache::Cookie", "fetch") ? Apache::Cookie->fetch : CGI::Cookie->fetch;
on the assumption that at least one method will work.
Examining the value of $m->ah->args_method directory is ugly :)
%doc>