File: Defer.pm

package info (click to toggle)
libmason-perl 2.24-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 748 kB
  • sloc: perl: 4,882; makefile: 7
file content (36 lines) | stat: -rw-r--r-- 577 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package Mason::t::Defer;
$Mason::t::Defer::VERSION = '2.24';
use Test::More;
use strict;
use warnings;
use base qw(Mason::Test::Class);

sub test_defer : Test(1) {
    my $self = shift;
    $self->{interp} = $self->create_interp( plugins => [ '@Default', 'Defer' ] );
    $self->test_comp(
        src => <<'EOF',
<%class>
my ($title, $subtitle);
</%class>

Title is <% $m->defer(sub { $title }) %>

% $.Defer {{
Subtitle is <% $subtitle %>
% }}

<%perl>
$title = 'foo';
$subtitle = 'bar';
</%perl>
EOF
        expect => <<'EOF',
Title is foo

Subtitle is bar
EOF
    );
}

1;