Mason(3pm)

πŸ“¦
version 2.24 Β· 2 versions
  • 2.24 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 2.24 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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>


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