HTML::Mason

Mason is a powerful Perl-based web site development and delivery engine. With Mason you can embed Perl code in your HTML and construct pages from shared, reusable components.

Installing HTML::Mason

  • Using the CPAN shell

    Perform the installation as the same user that the web server was installed as.

    # $ZEUSHOME/zperl/bin/perl -MCPAN -e shell
    cpan> install HTML::Mason
    

    The CPAN shell will prompt to install all the necessary dependencies for you.

  • Manually

    Download the HTML::Mason package and untar it. Run the following commands in the directory that is created.

    $ $ZEUSHOME/zperl/bin/perl Makefile.PL
    
    $ make
    $ make test
    

    Now, install HTML::Mason; run the following command as the same user that the web server was installed as:

    # make install
    

    The HTML::Mason documentation lists dependencies that must be installed prior to installing HTML::Mason.

Configuring HTML::Mason

Create a virtual server, or edit an existing virtual server. Enable Perl Extensions (API Support: Perl) and htaccess (Access: htaccess Support), and create a global .htaccess file containing the following:

 PerlModule Zeus::ModPerl::Server

PerlModule HTML::Mason::ApacheHandler

<FilesMatch "\.html$">
   SetHandler perl-script
   PerlHandler HTML::Mason::ApacheHandler

</FilesMatch>

HTML::Mason creates a private cache in the directory $ZEUSHOME/mason. If your web server is running as root, the Perl runner will not have the correct permissions to create this directory; create it manually, and set the permissions accordingly (eg, chown nobody).

Restart your virtual server, and verify that you can retrieve pages from the web site.

Testing HTML::Mason

Insert the following text into one of your .html pages:

2+2=<% 2+2 %>

HTML::Mason will parse and handle all text inside the <% and %> brackets; when you reload the page, you should see the following:

2+2=4

Troubleshooting

Error messages are logged to the file $ZEUSHOME/web/log/errors. Review this file if you encounter any problems.

Content Manager [Administrator] 14 December 2005  Permalink  
Leave a comment ...
Your email address will not be displayed.
Your URL will be displayed.
This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.
Options:
 
(Line breaks become <br />)
(Set cookies for name, email & url)
Download Free Trial

Recent Articles

Other Resources



www.zeus.com