.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "HTML::Mason 3pm" .TH HTML::Mason 3pm "2017-11-06" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTML::Mason \- High\-performance, dynamic web site authoring system .SH "VERSION" .IX Header "VERSION" version 1.58 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& PerlModule HTML::Mason::ApacheHandler \& \& \& SetHandler perl\-script \& PerlHandler HTML::Mason::ApacheHandler \& .Ve .SH "DESCRIPTION" .IX Header "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. .PP 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. .PP Mason's various pieces revolve around the notion of \*(L"components''. A component is a mix of \s-1HTML,\s0 Perl, and special Mason commands, one component per file. So-called \*(R"top-level" components represent entire web-pages, while smaller components typically return \s-1HTML\s0 snippets for embedding in top-level components. This object-like architecture greatly simplifies site maintenance: change a shared component, and you instantly changed all dependent pages that refer to it across a site (or across many virtual sites). .PP 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 \s-1HTML.\s0 In our own experience, this frees content managers (i.e., non-programmers) to work on the layout without getting mired in programming details. Techies, however, still enjoy the full power of Perl. .PP Mason works by intercepting innocent-looking requests (say, http://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. .PP Consider this simple Mason component: .PP .Vb 3 \& % my $noun = \*(AqWorld\*(Aq; \& Hello <% $noun %>! \& How are ya? .Ve .PP The output of this component is: .PP .Vb 2 \& Hello World! \& How are ya? .Ve .PP In this component you see a mix of standard \s-1HTML\s0 and Mason elements. The bare '%' prefixing the first line tells Mason that this is a line of Perl code. One line below, the embedded <% ... %> tag gets replaced with the return value of its contents, evaluated as a Perl expression. .PP 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. .SH "WAIT \- HAVE YOU SEEN MASON 2?" .IX Header "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. .PP Version 2 of Mason \*(-- Mason \*(-- was released in February of 2011. It offers a new syntax as well as a number of other features. See for details of the differences between the two. .SH "INSTALLATION" .IX Header "INSTALLATION" Mason has been tested under Linux, FreeBSD, Solaris, \s-1HPUX,\s0 and Win32. As an all-Perl solution, it should work on any machine that has working versions of Perl 5.00503+, mod_perl, and the required \s-1CPAN\s0 modules. .PP Mason has a standard MakeMaker-driven installation. See the \s-1README\s0 file for details. .SH "CONFIGURING MASON" .IX Header "CONFIGURING MASON" This section assumes that you are able to install and configure a mod_perl server. Relevant documentation is available at http://www.apache.org (Apache) and http://perl.apache.org (mod_perl). The mod_perl mailing list, archive, and guide are also great resources. .PP The simplest configuration of Mason requires a few lines in your httpd.conf: .PP .Vb 1 \& PerlModule HTML::Mason::ApacheHandler \& \& \& SetHandler perl\-script \& PerlHandler HTML::Mason::ApacheHandler \& .Ve .PP 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. .PP The 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. .PP Once you have added the configuration directives, restart the server. First, go to a standard \s-1URL\s0 on your site to make sure you haven't broken anything. If all goes well you should see the same page as before. If not, recheck your Apache config files and also tail your server's error log. .PP If you are getting \*(L"404 Not Found\*(R" 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. .PP Next, try adding the tag <% 2+2 %> at the top of some \s-1HTML\s0 file. If you reload this page and see a \*(L"4\*(R", Mason is working! .SH "DOCUMENTATION ROADMAP" .IX Header "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 Request \s-1API\s0 documentation, HTML::Mason::Request. .PP Whoever 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. .PP 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 \s-1CGI\s0 script, refer to the HTML::Mason::CGIHandler documentation. If you are using Mason from a standalone program, refer to the Using Mason from a Standalone Script section of the administrator's manual. .PP There is also a book about Mason, \fIEmbedding Perl in \s-1HTML\s0 with Mason\fR, by Dave Rolsky and Ken Williams, published by O'Reilly and Associates. The book's website is at http://www.masonbook.com/. This book goes into detail on a number of topics, and includes a chapter of recipes as well as a sample Mason-based website. .SH "GETTING HELP AND SOURCES" .IX Header "GETTING HELP AND SOURCES" Questions and feedback are welcome, and should be directed to the Mason mailing list. You must be subscribed to post. .PP .Vb 1 \& https://lists.sourceforge.net/lists/listinfo/mason\-users .Ve .PP You can also visit us at \f(CW\*(C`#mason\*(C'\fR on . .PP Bugs and feature requests will be tracked at \s-1RT:\s0 .PP .Vb 2 \& http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML\-Mason \& bug\-html\-mason@rt.cpan.org .Ve .SH "SUPPORT" .IX Header "SUPPORT" Bugs may be submitted at or via email to bug\-html\-mason@rt.cpan.org . .PP I am also usually active on \s-1IRC\s0 as 'autarch' on \f(CW\*(C`irc://irc.perl.org\*(C'\fR. .SH "SOURCE" .IX Header "SOURCE" The source code repository for HTML-Mason can be found at . .SH "AUTHORS" .IX Header "AUTHORS" .IP "\(bu" 4 Jonathan Swartz .IP "\(bu" 4 Dave Rolsky .IP "\(bu" 4 Ken Williams .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" .IP "\(bu" 4 Ævar Arnfjörð Bjarmason .IP "\(bu" 4 Alex Balhatchet .IP "\(bu" 4 Alex Vandiver .IP "\(bu" 4 John Williams .IP "\(bu" 4 Kent Fredric .IP "\(bu" 4 Kevin Falcone .IP "\(bu" 4 Patrick Kane .IP "\(bu" 4 Ricardo Signes .IP "\(bu" 4 Shlomi Fish .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 1998 \- 2017 by Jonathan Swartz. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. .PP The full text of the license can be found in the \&\fI\s-1LICENSE\s0\fR file included with this distribution.