9630ac838a8e5d785dd76e02d47816e1d4f97b80
[odin-cgi] / mason / common / autohandler
1 <%perl>
2 Odin::set_mason_failproc $m;
3 Odin::cgi_who $r;
4 Odin::fetch_cookies $r;
5 $r->content_type("text/html; charset=utf8");
6 $m->call_next;
7 </%perl>
8 %#
9 <%method wrapper>\
10 % $r->header_out(Status => $status) if defined $status;
11 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
12 "http://www.w3c.org/TR/html4/strict.dtd">
13
14 <html>
15 <head>
16 <link rel="stylesheet" type="text/css" href="<% $Odin::STATIC %>odin.css">
17 <meta name="viewport" content="width=device-width" initial-scale=1.0>
18 <& SELF:header &>
19 <title>\
20 % defined $title ? $m->print($title) : $m->comp("SELF:title");
21 </title>
22 </head>
23 <body>
24
25 <% $m->content %>
26 <div class="footer">
27 Written by Mark Wooding<br>
28 </div>
29 </body>
30 </html>
31 <%args>
32 $status => undef
33 $title => undef
34 </%args>
35 </%method>
36 %#
37 <%method title>(Untitled page)</%method>
38 <%method header></%method>
39 %#
40 <%method error>\
41 <&| SELF:wrapper, status => $status, title => $title // $m->content &>\
42 <h1>\
43 % if (defined $title) {
44 Error: <% $title %>\
45 % } else {
46 Error\
47 % }
48 </h1>
49 <p><% $m->content %>
50 </&>
51 <%args>
52 $status => 500
53 $title => undef
54 </%args>
55 </%method>
56 %#
57 <%once>
58 use utf8;
59 use Odin;
60 </%once>