line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use Moose; |
2
|
1
|
|
|
1
|
|
67059
|
with 'Email::MIME::Kit::Role::Renderer'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: render parts of your mail with Text::Template |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Module::Runtime (); |
6
|
1
|
|
|
1
|
|
5618
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
315
|
|
7
|
|
|
|
|
|
|
my ($self, $hash) = @_; |
8
|
|
|
|
|
|
|
|
9
|
8
|
|
|
8
|
|
18
|
my %return; |
10
|
|
|
|
|
|
|
while (my ($k, $v) = each %$hash) { |
11
|
8
|
|
|
|
|
12
|
$return{ $k } = (ref $v and not blessed $v) ? $v : \$v; |
12
|
8
|
|
|
|
|
29
|
} |
13
|
21
|
50
|
33
|
|
|
109
|
|
14
|
|
|
|
|
|
|
return \%return; |
15
|
|
|
|
|
|
|
} |
16
|
8
|
|
|
|
|
18
|
|
17
|
|
|
|
|
|
|
#pod =attr template_class |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod This attribute stores the name of the class that will be standing in for |
20
|
|
|
|
|
|
|
#pod Text::Template, if any. It defaults, obviously, to Text::Template. |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod =cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has template_class => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
isa => 'Str', |
27
|
|
|
|
|
|
|
default => 'Text::Template', |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#pod =attr template_args |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod These are the arguments that will be passed to C<fill_this_in> along with the |
33
|
|
|
|
|
|
|
#pod template, input, and a few required handlers. |
34
|
|
|
|
|
|
|
#pod |
35
|
|
|
|
|
|
|
#pod =cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has template_args => ( |
38
|
|
|
|
|
|
|
is => 'ro', |
39
|
|
|
|
|
|
|
isa => 'HashRef', |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my ($self, $input_ref, $args)= @_; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $hash = $self->_enref_as_needed({ |
45
|
8
|
|
|
8
|
0
|
85689
|
(map {; $_ => ref $args->{$_} ? $args->{$_} : \$args->{$_} } keys %$args), |
46
|
|
|
|
|
|
|
}); |
47
|
|
|
|
|
|
|
|
48
|
8
|
100
|
|
|
|
36
|
my $template_class = $self->template_class; |
|
21
|
|
|
|
|
71
|
|
49
|
|
|
|
|
|
|
Module::Runtime::require_module($template_class); |
50
|
|
|
|
|
|
|
|
51
|
8
|
|
|
|
|
266
|
my $result = $template_class->fill_this_in( |
52
|
8
|
|
|
|
|
28
|
$$input_ref, |
53
|
|
|
|
|
|
|
%{ $self->{template_args} || {} }, |
54
|
|
|
|
|
|
|
HASH => $hash, |
55
|
|
|
|
|
|
|
BROKEN => sub { my %hash = @_; die $hash{error}; }, |
56
|
8
|
50
|
|
|
|
82
|
); |
57
|
|
|
|
|
|
|
|
58
|
2
|
|
|
2
|
|
974
|
# :-( -- rjbs, 2012-10-01 |
|
2
|
|
|
|
|
30
|
|
59
|
8
|
|
|
|
|
4246
|
die $Text::Template::ERROR unless defined $result; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
return \$result; |
62
|
6
|
50
|
|
|
|
3141
|
} |
63
|
|
|
|
|
|
|
|
64
|
6
|
|
|
|
|
29
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=pod |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=encoding UTF-8 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 NAME |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Email::MIME::Kit::Renderer::Text::Template - render parts of your mail with Text::Template |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 VERSION |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
version 1.101303 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 PERL VERSION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
82
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
83
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
84
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
87
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
88
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
89
|
|
|
|
|
|
|
the minimum required perl. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 template_class |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This attribute stores the name of the class that will be standing in for |
96
|
|
|
|
|
|
|
Text::Template, if any. It defaults, obviously, to Text::Template. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 template_args |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
These are the arguments that will be passed to C<fill_this_in> along with the |
101
|
|
|
|
|
|
|
template, input, and a few required handlers. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Ricardo Signes <rjbs@semiotic.systems> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Ricardo Signes. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
112
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |