|
|
|
|
|
Who is this for
What you need to know Introduction With HTML::Mason, the Perl script is embedded in the HTML code. This
means that the HTML skeleton is coded and logic code is written only in
portions of the script that needs it. Installing HTML::Mason Installation instructions for HTML::Mason on for Apache 1.3 and
mod_perl 1.0 is straightforward. Before installing HTML::Mason, make
sure that mod_perl is already installed on Apache. Download the module
from CPAN or from the HTML::Mason
website. Do a : perl MakefileOnce installed, you will need to configure the Apache server. Edit
the httpd.conf file and make sure you include this: PerlModule
HTML::Mason::ApacheHandler<Location /usr/local/apache/htdocs/mason>SetHandler perl-scriptPerlHandler HTML::Mason::ApacheHandler</Location>You can also use the Directory or Files directive to make
HTML::Mason work in specific directory or files. Installation instructions for HTML::Mason on Apache 2.0 and mod_perl
2.0 are available at:
http://beaucox.com/mason/mason-with-apmp... Sample HTML::Mason Code <%perl>use Date::Calc;my @today = Date::Calc->Today();my $str = "$today[0]-$today[1]-$today[2]";</%perl><html><body>Today is <%$str %></body></html>Notice that the Perl code is embedded in the HTML page. Perl code is executed when the interpreter encounters a <%perl>.
Perl code ends when the interpreter encounters a </%perl>.Likewise, notice that you can also have a variable called $str
printed with the HTML by escaping it with a <% %>. If you want to learn more about HTML::Mason, you can check the documentation that comes with the module. or visit the HTML::Mason website. Go To Page: 1 |
|
|
|