Perl’s Mason: A solution for large dynamic websites building
Perl’s Mason (http://www.masonhq.com/) is a powerful Perl-based web site development and delivery engine. Currently it has 2 versions (in CPAN: version 1 is HTML::Mason, version 2 is Mason).
With the supports of Apache/mod_perl‘s persistent environments, Mason is a powerful, high-performance templating for the web and beyond: it solves the common problems of site development: caching, debugging, templating, maintaining development and production sites, and more. So it is suitable for large, dynamic driven websites. Amazon, Delicious are the users.
From the following example we can see how it works:
1. HTML template file index.mc:
% my $name = "Mason";
Hello world! Welcome to <% $name %>.
2. Mason calls the template file:
my $mason = Mason->new(comp_root => '...');
It differs from other template systems: unlike many templating systems, Mason does not attempt to invent an alternate, “easier” syntax for templates. It provides a set of syntax and features specific to template creation, but underneath it is still clearly and proudly recognizable as Perl.
Mason is most often used for generating web pages. It can handle web requests directly via PSGI, or act as the view layer for a web framework such as Catalyst or Dancer.
In Perl, there are many templates systems can be used as presentation layer, such as:
Among them, Mason is used for building large dynamic websites,
With Mason we can embed Perl code in HTML and construct pages from shared, reusable components.