December 2002
Intermediate to advanced
496 pages
9h 40m
English
Let’s show an example. We create the file /var/www/html/mason/test.html and place the following contents within it: [1]
[1] Set the permissions to 644, but you already knew that, right?
% my $name = ´John Doe´; <html> <head> <title>Mason Example</title> </head> <body bgcolor="#ffffff"> Hello, <% $name %>! <br>2 + 3 = <% 2 + 3 %> </body> </html>
You will notice right away that our first Mason example is not “hello, world!”. We apologize for the inconsistency.
At the top of this file is % my $name = ´John Doe´;. The character “%” indicates that this line is Perl code to be executed. [2] The variable $name is defined using the my() function. Global variables in Mason must be my() variables—if they are not declared with
Read now
Unlock full access