HTTP::...::Mason(3pm)
π HTTP::...::Mason π
okay bestie, welcome to HTTP::...::Mason(3pm) β yes the manual name has dots in it, she's mysterious like that, we don't question it π
this is the User Contributed Perl Documentation era, and it's giving standalone mason server energy.
β¨ NAME β¨
HTTP::Server::Simple::Mason β an abstract baseclass for a standalone mason server. that's the whole name, that's the whole vibe π«Ά
πΈ SYNOPSIS πΈ
so this is the whole little ritual, copy it exactly okay:
my $server = MyApp::Server->new();
$server->run;
package MyApp::Server;
use base qw/HTTP::Server::Simple::Mason/;
sub mason_config {
return ( comp_root => '/tmp/mason-pages' );
}
that's it. that's the entire main character arc. β¨
π¦ DESCRIPTION π¦
okay so lowkey? this section is literally empty in the original. no cap, nothing in it. she said "no thoughts, head empty" and honestly? respect. π
π INTERFACE π
for the bigger picture, go read HTTP::Server::Simple and also the docs right down below. both. do both. π«Ά
π mason_handler
returns the server's HTML::Mason::CGIHandler object. the first time you call this, it goes and makes a brand new handler by calling new_handler. so it's a lazy girlie, it only builds when you ask. π
π handle_request CGI
called with a CGI object. invokes mason and runs the request. that's the assignment, that's the job, she ate. π₯
π handle_error ERROR
if the call to handle_request straight up dies, then handle_error gets called with the exception β that's $@ btw. by default? it does absolutely nothing. iconic. but your subclass can override it, so go off. β¨
π§ new_handler
creates and returns a new HTML::Mason::CGIHandler, configured by whatever default_mason_config and mason_config say. ngl you do not need to call this yourself β mason_handler will automatically call it the first time it's called. it handles it. let her. π«Ά
π handler_class
returns the name of the Mason handler class invoked in new_handler. defaults to HTML::Mason::CGIHandler, but in your subclass you may wish to change it to a subclass of HTML::Mason::CGIHandler. slay, customize your girl. π
β setup_escapes $handler
sets up the Mason escapes for the handler $handler. for example, the h in:
<% $name | h %>
by default, sets h to HTTP::Server::Simple::Mason::escape_utf8 and u to HTTP::Server::Simple::Mason::escape_uri. but you can override this in your subclass, because it's your world. π
πΈ mason_config
returns a subclass-defined mason handler configuration. you almost certainly want to override it and specify at least comp_root. like, please. do it. π
π default_mason_config
returns the default mason handler configuration β which can be overridden by entries in mason_config. she's the baseline, the blueprint, the starter pack. β¨
π¦ escape_utf8 SCALARREF
does a css-busting but minimalist escaping of whatever html you're passing in. minimalist queen. π
π escape_uri SCALARREF
escapes URI component according to RFC2396. yes she cites the RFC, she's that girl. π
π CONFIGURATION AND ENVIRONMENT π
for most configuration, go see HTTP::Server::Simple.
you can (and must) configure your mason CGI handler by subclassing this module and overriding the subroutine mason_config. and the most important thing, the thing that matters most, the vibe check that you cannot fail: set a component root (that's where your pages live) by adding
comp_root => '/some/absolute/path'
see the Synopsis section or ex/sample_server.pl in the distribution for a complete example. π«Ά
fr fr, set your comp_root. absolute path. no shortcuts. bestie I'm begging. π
π DEPENDENCIES π
HTTP::Server::SimpleHTML::Mason
π INCOMPATIBILITIES π
none reported. β¨ (iconic, honestly)
π BUGS AND LIMITATIONS π
please report any bugs or feature requests to bug-http-server-simple-mason@rt.cpan.org, or through the web interface at <http://rt.cpan.org>. she's listening, she wants your feedback. π«Ά
β AUTHOR β
Jesse Vincent <jesse@bestpractical.com> β the legend, the founder of the whole thing. π
π LICENCE AND COPYRIGHT π
Copyright (c) 2001-2005, Jesse Vincent <jesse@bestpractical.com>. All rights reserved.
this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, open source. π
πΈ DISCLAIMER OF WARRANTY πΈ
okay this part is in all caps in the original and it's all caps for a reason, so here's the whole thing, exactly as serious as she sounds:
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
and that's the whole page bestie!! π this one was rendered by perl v5.36.0 and dated 2022-11-20, so if you're reading this on some other version, no shade, just know she's a 2022 girlie. mwah, go build something cute. π β¨π¦
π¦ where this page comes from
- debian bookworm: libhttp-server-simple-mason-perl 0.14-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhttp-server-simple-mason-perl 0.14-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhttp-server-simple-mason-perl 0.14-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhttp-server-simple-mason-perl 0.14-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhttp-server-simple-mason-perl 0.14-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms