11.7. Mason Components

Mason allows construction of complex web sites through the notion of components. A Mason component is a file with any combination of HTML, Perl, and Mason code.

For a simple example, we will create a header file and footer file that will be applied across the web site.

First, we’ll create some header HTML and put it in the file /var/www/html/mason/_header. The following HTML is the beginning HTML for the example:

<html> 
<head> 
<title>Mason Component Example</title> 
</head> 
<body bgcolor="#ffffff"> 
<i>This text is in the header.</i> 
<hr> 

Don’t panic [3]—this is just basic HTML. No new stuff here. This illustrates that a Mason component need not contain any Mason at all—plain HTML is fine. This HTML is then included when ...

Get Open Source Web Development with LAMP: Using Linux, Apache, MySQL, Perl, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.