HTML::Mason (3)
Leading comments
Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) Standard preamble: ========================================================================
NAME
Mason - High-performance, dynamic web site authoring systemVERSION
version 1.56SYNOPSIS
PerlModule HTML::Mason::ApacheHandler <Location /> SetHandler perl-script PerlHandler HTML::Mason::ApacheHandler </Location>
DESCRIPTION
Mason is a tool for building, serving and managing large web sites. Its features make it an ideal backend for high load sites serving dynamic content, such as online newspapers or database driven e-commerce sites.Actually, Mason can be used to generate any sort of text, whether for a web site or not. But it was originally built for web sites and since that's why most people are interested in it, that is the focus of this documentation.
Mason's various pieces revolve around the notion of ``components''. A component is a mix of
Mason's component syntax lets designers separate a web page into programmatic and design elements. This means the esoteric Perl bits can be hidden near the bottom of a component, preloading simple variables for use above in the
Mason works by intercepting innocent-looking requests (say, www.yoursite.com/index.html and mapping them to requests for Mason components. Mason then compiles the component, runs it, and feeds the output back to the client.
Consider this simple Mason component:
% my $noun = 'World'; Hello <% $noun %>! How are ya?
The output of this component is:
Hello World! How are ya?
In this component you see a mix of standard
Beyond this trivial example, components can also embed serious chunks of Perl code (say, to pull records from a database). They can also call other components, cache results for later reuse, and perform all the tricks you expect from a regular Perl program.
WAIT - HAVE YOU SEEN MASON 2?
Version 1 of Mason (this distribution) --- has been around since 1998, is in wide use, and is very stable. However it has not changed much in years and is no longer actively developed.Version 2 of Mason --- Mason --- was released in February of 2011. It is more actively developed and has a much more modern architecture. If you are just starting out, we recommend you give Mason 2 a try.
For a summary of differences between Mason 1 and 2 see
www.openswartz.com/2011/02/21/announcing-mason-2
INSTALLATION
Mason has been tested under Linux, FreeBSD, Solaris,Mason has a standard MakeMaker-driven installation. See the
CONFIGURING MASON
This section assumes that you are able to install and configure a mod_perl server. Relevant documentation is available at www.apache.org (Apache) and perl.apache.org (mod_perl). The mod_perl mailing list, archive, and guide are also great resources.The simplest configuration of Mason requires a few lines in your httpd.conf:
PerlModule HTML::Mason::ApacheHandler <Location /> SetHandler perl-script PerlHandler HTML::Mason::ApacheHandler </Location>
The PerlModule directive simply ensures that the Mason code is loaded in the parent process before forking, which can save some memory when running mod_perl.
The <Location> section routes all requests to the Mason handler, which is a simple way to try out Mason. A more refined setup is discussed in the Controlling Access via Filename Extension section of the administrator's manual.
Once you have added the configuration directives, restart the server. First, go to a standard
If you are getting ``404 Not Found'' errors even when the files clearly exist, Mason may be having trouble with your document root. One situation that will unfortunately confuse Mason is if your document root goes through a symbolic link. Try expressing your document root in terms of the true filesystem path.
Next, try adding the tag <% 2+2 %> at the top of some
DOCUMENTATION ROADMAP
Once Mason is on its feet, the next step is to write a component or two. The Mason Developer's Manual is a complete tutorial for writing, using, and debugging components. A reference companion to the Developer's Manual is the RequestWhoever is responsible for setting up and tuning Mason should read the Administrator's Manual, though developers will also benefit from reading it as well. This document covers more advanced configuration scenarios and performance optimization. The reference companion to the Administrator's manual is the Parameters Reference, which describes all the parameters you can use to configure Mason.
Most of this documentation assumes that you're running Mason on top of mod_perl, since that is the most common configuration. If you would like to run Mason via a
There is also a book about Mason, Embedding Perl in
GETTING HELP AND SOURCES
Questions and feedback are welcome, and should be directed to the Mason mailing list. You must be subscribed to post.
lists.sourceforge.net/lists/listinfo/mason-users
You can also visit us at "#mason" on <irc://irc.perl.org/#mason>.
Bugs and feature requests will be tracked at
rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Mason bug-html-mason@rt.cpan.org
AUTHORS
- *
- Jonathan Swartz <swartz@pobox.com>
- *
- Dave Rolsky <autarch@urth.org>
- *
- Ken Williams <ken@mathforum.org>
CONTRIBUTORS
- *
- AEvar Arnfjo.rd- Bjarmason <avarab@gmail.com>
- *
- Alex Vandiver <alex@chmrr.net>
- *
- John Williams <jwilliams@cpan.org>
- *
- Kevin Falcone <falcone@bestpractical.com>
- *
- Patrick Kane <modus-cpan@pr.es.to>
- *
- Ricardo Signes <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 1998 - 2014 by Jonathan Swartz.This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.