Mason(3pm)
π Mason β like, the whole vibe π
okay bestie, so this is Mason, and it lives in your friendly neighborhood User Contributed Perl Documentation section, section 3pm. Pull up a chair, we're gonna talk about it. π«Ά
β¨ NAME β¨
Mason β powerful, high-performance templating for the web and beyond π
no cap, that's literally the name line. "and beyond" is doing a lot of work there and we respect it.
π SYNOPSIS π
here's the lil taste test. first, a template file called foo.mc:
foo.mc:
% my $name = "Mason";
Hello world! Welcome to <% $name %>.
and then your actual Perl script doing the thing:
#!/usr/local/bin/perl
use Mason;
my $mason = Mason->new(comp_root => '...');
print $mason->run('/foo')->output;
see how it's just... Perl? with lil <% %> sparkles? that's the whole point bestie. π¦
πΈ DESCRIPTION πΈ
so, Mason is a powerful Perl-based templating system, and it was designed to generate dynamic content of all kinds. all of them. every kind. π
here's the thing that makes it different from other templating systems, and I need you to really hear me on this: Mason does not try to invent some alternate, "easier" syntax for templates. nope. it gives you a set of syntax and features that are specific to template creation, sure, but underneath all of it, it is still clearly and proudly recognizable as Perl. like, it's not hiding. it's not pretending. it's giving Perl, because it IS Perl. periodt. π
Mason is most often used for generating web pages β that's its main character era. it has a companion web framework called Poet, which was designed to take maximum advantage of its routing and content generation features. it can also be used as the templating layer for web frameworks such as Catalyst and Dancer. so like, it's flexible. it plays nice. β¨
all the documentation is indexed at Mason::Manual β that's your one-stop shop, bookmark it fr fr. π
and oh, also: the previous major version of Mason (that's 1.x, the OG) is available under the name HTML::Mason. so if you're out here looking for the old one, that's where it's at. π
π¬ SUPPORT π¬
need help? got feelings? we got you.
the mailing list is "mason-users@lists.sourceforge.net". important tho: you must be subscribed to send a message, so don't just roll up uninvited. to subscribe, visit:
https://lists.sourceforge.net/lists/listinfo/mason-users
you can also come hang out with us at "#mason" on:
irc://irc.perl.org/#mason
bugs and feature requests get tracked at RT:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Mason
bug-mason@rt.cpan.org
and if you wanna peek at (or grab) the latest source code, it's right here:
http://github.com/jonswar/perl-mason
git clone git://github.com/jonswar/perl-mason.git
the official Mason website is <http://www.masonhq.com/> β BUT, and I'm gonna be honest with you bestie, it mostly has info about Mason 1 on it. we're not sure what the future of the website will be wrt Mason 2. so like... it's there. that's what it is. π
π«Ά ACKNOWLEDGEMENTS π«Ά
shoutout time, because we are grateful and we are not afraid to say it.
thanks to Stevan Little and the Moose team for the awesomeness of Moose, which is literally what motivated the author to create a second version of Mason years after he thought he was done. the way a good tool will just drag you back in. iconic. π¦
thanks to Tatsuhiko Miyagawa and the PSGI/Plack team (<http://plackperl.org/>), who freed him from ever worrying about server backends again. not me being emotional about not worrying about server backends. π
π SEE ALSO π
HTML::Masonβ the 1.x era, for the historians and the legacy codebases. iykyk.
π AUTHOR π
Jonathan Swartz <swartz@pobox.com>
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2012 by Jonathan Swartz.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay. π
okay and finally, the lil sign-off: this whole page is Mason(3pm), from perl v5.34.0, dated 2022-05-27. so that's the version, that's the date, and that's the tea. go build something cute with it bestie, ily, bye! ππβ¨
π¦ where this page comes from
- debian bookworm: libmason-perl 2.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmason-perl 2.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmason-perl 2.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmason-perl 2.24-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmason-perl 2.24-2 Β· 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