1HTTP::Server::Simple::MUasseorn(C3o)ntributed Perl DocumHeTnTtPa:t:iSoenrver::Simple::Mason(3)
2
3
4
6 HTTP::Server::Simple::Mason - An abstract baseclass for a standalone
7 mason server
8
10 my $server = MyApp::Server->new();
11
12 $server->run;
13
14 package MyApp::Server;
15 use base qw/HTTP::Server::Simple::Mason/;
16
17 sub mason_config {
18 return ( comp_root => '/tmp/mason-pages' );
19 }
20
23 See HTTP::Server::Simple and the documentation below.
24
25 mason_handler
26 Returns the server's "HTML::Mason::CGIHandler" object. The first time
27 this method is called, it creates a new handler by calling
28 "new_handler".
29
30 handle_request CGI
31 Called with a CGI object. Invokes mason and runs the request
32
33 handle_error ERROR
34 If the call to "handle_request" dies, "handle_error" is called with the
35 exception (that is, $@). By default, it does nothing; it can be
36 overriden by your subclass.
37
38 new_handler
39 Creates and returns a new "HTML::Mason::CGIHandler", with configuration
40 specified by the "default_mason_config" and "mason_config" methods.
41 You don't need to call this method yourself; "mason_handler" will
42 automatically call it the first time it is called.
43
44 handler_class
45 Returns the name of the Mason handler class invoked in "new_handler".
46 Defaults to HTML::Mason::CGIHandler, but in your subclass you may wish
47 to change it to a subclass of HTML::Mason::CGIHandler.
48
49 setup_escapes $handler
50 Sets up the Mason escapes for the handler $handler. For example, the
51 "h" in
52
53 <% $name | h %>
54
55 By default, sets "h" to "HTTP::Server::Simple::Mason::escape_utf8" and
56 "u" to "HTTP::Server::Simple::Mason::escape_uri", but you can override
57 this in your subclass.
58
59 mason_config
60 Returns a subclass-defined mason handler configuration; you almost
61 certainly want to override it and specify at least "comp_root".
62
63 default_mason_config
64 Returns the default mason handler configuration (which can be
65 overridden by entries in "mason_config").
66
67 escape_utf8 SCALARREF
68 does a css-busting but minimalist escaping of whatever html you're
69 passing in.
70
71 escape_uri SCALARREF
72 Escapes URI component according to RFC2396
73
75 For most configuration, see HTTP::Server::Simple.
76
77 You can (and must) configure your mason CGI handler by subclassing this
78 module and overriding the subroutine "mason_config". It's most
79 important that you set a component root (where your pages live) by
80 adding
81
82 comp_root => '/some/absolute/path'
83
84 See the Synopsis section or "ex/sample_server.pl" in the distribution
85 for a complete example.
86
88 HTTP::Server::Simple HTML::Mason
89
91 None reported.
92
94 Please report any bugs or feature requests to
95 "bug-http-server-simple-mason@rt.cpan.org", or through the web
96 interface at <http://rt.cpan.org>.
97
99 Jesse Vincent "<jesse@bestpractical.com>"
100
102 Copyright (c) 2001-2005, Jesse Vincent "<jesse@bestpractical.com>".
103 All rights reserved.
104
105 This module is free software; you can redistribute it and/or modify it
106 under the same terms as Perl itself.
107
109 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
110 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
111 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
112 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
113 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
114 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
115 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
116 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
117 NECESSARY SERVICING, REPAIR, OR CORRECTION.
118
119 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
120 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
121 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
122 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
123 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
124 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
125 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
126 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
127 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
128 DAMAGES.
129
130
131
132perl v5.30.0 2019-07-26 HTTP::Server::Simple::Mason(3)