HTML::...andler(3pm)

πŸ“¦
version 0.53 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– HTML::Mason::PSGIHandler β€” the manual, but make it cute πŸ’–

okay bestie, pull up a chair, we're reading the docs for HTML::Mason::PSGIHandler, a User Contributed Perl Documentation page, and honestly? it's giving "small module, big slay". πŸ’…


✨ NAME ✨

HTML::Mason::PSGIHandler β€” a PSGI handler for HTML::Mason. that's it, that's the name, she's concise πŸ¦‹


🌸 SYNOPSIS 🌸

here's the whole vibe in one app.psgi, no cap:

# app.psgi
use HTML::Mason::PSGIHandler;

my $h = HTML::Mason::PSGIHandler->new(
    comp_root => "/path/to/doc_root", # required
);

my $handler = sub {
    my $env = shift;
    $h->handle_psgi($env);
};

yes the comp_root is required, she's not optional, don't try it πŸ’€


πŸŽ€ DESCRIPTION πŸŽ€

So. HTML::Mason::PSGIHandler is a PSGI handler for HTML::Mason. It's built on top of HTML::Mason::CGIHandler, and what that means for you is: you can process Mason templates on any web server that supports PSGI. any of them. all of them. go off. πŸ”₯


πŸ‘‘ METHODS πŸ‘‘

⭐ as_psgi

This method returns a subroutine you can use as a PSGI application. iconic behavior, honestly

In other words β€” and this is the part that matters β€” these two are equivalent:

my $app = sub {
  my $env = shift;
  $h->handle_psgi($env);
};

my $app = $h->as_psgi;

same energy. literally the same thing. pick your fighter. 🫢

πŸ¦‹ new_psgi

mount '/foo' => HTML::Mason::PSGIHandler->new_psgi( ... );

This one combines new and as_psgi so it immediately hands you back a subroutine that works as a PSGI application. It's the move when you want to use it inline with Plack::Builder. 🧚


πŸ’œ SUPPORT πŸ’œ

fr fr, report them there, don't just suffer in silence 😭

🌈 AUTHORS 🌈

the whole squad, give it up: Ask BjΓΈrn Hansen <miyagawa@bulknews.net>, Ricardo Signes <rjbs@cpan.org>, Tatsuhiko Miyagawa <miyagawa@bulknews.net>, Ruslan Zakirov <ruz@bestpractical.com>. πŸ‘‘


πŸ“ LICENSE πŸ“

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so generous, so legal, so correct πŸ’–


🌟 SEE ALSO 🌟

CGI::PSGI Plack PSGI HTML::Mason::CGIHandler

go read those too, iykyk πŸŽ€


and that's the whole page, bestie!! this version was perl v5.26.1, dated 2018-04-02, and it's HTML::...andler(3pm) signing off. stay hydrated, keep your comp_root valid, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from