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