Mason:...:Defer(3pm)
β¨ Mason::Plugin::Defer β¨
ok so bestie, welcome to Mason::Plugin::Defer β it's part of the Mason plugin fam, and it ships in the User Contributed Perl Documentation collection as the 3pm page. This one is lowkey iconic: it lets you defer computing parts of output until the end of the request. π¦
π NAME π
Mason::Plugin::Defer β defer computing parts of output until the end of the request π
πΈ SYNOPSIS πΈ
<head>
<title><% $m->defer(sub { $m->page->title }) %></title>
% $.Defer {{
% my $content = join(", ", @{ $m->page->meta_content });
<meta name="description" content="<% $content %>">
% }}
<body>
...
β¨ DESCRIPTION β¨
So the defer feature lets chunks of your output justβ¦ chill until the end of the request. π No cap.
You can set up multiple deferred code blocks, and every single one of them will execute and insert itself into the output stream at request end. It's giving "we'll get to it, bestie" and honestly? slay. π
π REQUEST METHOD π
defer (code)
Returns a marker string that is unique and will not appear in normal output. π«Ά At the end of the request, each marker string is replaced with the output of its associated code. fr fr.
e.g.
<title><% $m->defer(sub { $m->page->title }) %></title>
π¦ FILTER π¦
Defer
Applies $m->defer to the content block. e.g.
% $.Defer {{
% my $content = join(", ", @{ $m->page->meta_content });
<meta name="description" content="<% $content %>">
% }}
π SEE ALSO π
- Mason
π 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.
okay that's the whole page, no notes π
perl v5.34.0 Β· 2022-05-27 Β· and that's a wrap on the Mason:...:Defer(3pm) page, mwah π πβ¨
π¦ 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