File: masontest.html

package info (click to toggle)
libhtml-mason-perl 1%3A1.58-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,796 kB
  • sloc: perl: 8,618; sh: 49; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 853 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%# -- start test component-- you should not see this line output
<html>
 <head>
  <title>Mason test</title>
 </head>
 <body>
  <h1> Mason test </h1>

% if ($r->auth_type) {
<p> Hello, &quot;<% $r->connection->user %>&quot; (<% $r->auth_name %>) </p>
% }

% for my $t (@$myvar) {
  <p> <% $t %> </p>
% } 

<hr>
<p> This test compoent accessed <%$counter%> times so far </p>
<address> <%$r->server->server_hostname%>:<%$r->server->port%> </address>

 </body>
</html>
<%init>
 my $myvar = ["hello world", "welcome to the test mason component"];

 # No, this is not a good example of how to implement a counter.
 my $counter = $m->cache->get("counter");
 if (!$counter) {
   $m->cache->set("counter", $counter = 1, "1h");
 }
 else {
   $m->cache->set("counter", ++$counter, "1h");
 }

</%init>
%# -- end test component-- you should not see this line output