HTTP::...::Mason(3pm)

πŸ“¦
version 0.14 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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::Simple
  • HTML::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. πŸ’…


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