Mason::Plugin::Defer(3pm)

Mason::Plugin::Defer3pm

Defer computing parts of output until the end of the request

Usage

    <head>
    <title><% $m->defer(sub { $m->page->title }) %></title>
    % $.Defer {{
    %   my $content = join(", ", @{ $m->page->meta_content });
    <meta name="description" content="<% $content %>">
    % }}
    <body>
    ...

Overview

The defer feature allows sections of output to be deferred til the end of the request. You can set up multiple deferred code blocks which will execute and insert themselves into the output stream at request end.

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. 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 %>">
    % }}

Releases

7 releases since Debian 7 (Wheezy); the text changed 4 times.

  1. 7
  2. 8
  3. 9–10
  4. 11
  5. 12–13

Author

Jonathan Swartz <[email protected]>

From libmason-perl 2.24-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.