| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MIME::Lite::TT; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
29537
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
41
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
71
|
|
|
5
|
|
|
|
|
|
|
$VERSION = '0.02'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1373
|
use MIME::Lite; |
|
|
1
|
|
|
|
|
43024
|
|
|
|
1
|
|
|
|
|
31
|
|
|
8
|
1
|
|
|
1
|
|
2782
|
use Template; |
|
|
1
|
|
|
|
|
38504
|
|
|
|
1
|
|
|
|
|
36
|
|
|
9
|
1
|
|
|
1
|
|
10
|
use Carp (); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
256
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
|
12
|
0
|
|
|
0
|
0
|
|
my ($class, %options) = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
%options = $class->_before_process(%options); |
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
if ( my $template = delete $options{Template} ) { |
|
17
|
0
|
|
0
|
|
|
|
my $tmpl_options = delete $options{TmplOptions} || {}; |
|
18
|
0
|
|
|
|
|
|
my %config = (ABSOLUTE => 1, |
|
19
|
|
|
|
|
|
|
RELATIVE => 1, |
|
20
|
|
|
|
|
|
|
%$tmpl_options, |
|
21
|
|
|
|
|
|
|
); |
|
22
|
0
|
0
|
|
|
|
|
if ( $options{TmplUpgrade}) { |
|
23
|
0
|
|
|
|
|
|
$config{LOAD_TEMPLATES} = [MIME::Lite::TT::Provider->new(\%config)]; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $tt = Template->new(\%config); |
|
27
|
0
|
|
0
|
|
|
|
my $tmpl_params = delete $options{TmplParams} || {}; |
|
28
|
0
|
0
|
|
|
|
|
$tt->process($template, $tmpl_params, \$options{Data}) |
|
29
|
|
|
|
|
|
|
or Carp::croak $tt->error; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
%options = $class->_after_process(%options); |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
MIME::Lite->new(%options); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _before_process { |
|
38
|
0
|
|
|
0
|
|
|
my $class = shift; |
|
39
|
0
|
|
|
|
|
|
@_; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _after_process { |
|
43
|
0
|
|
|
0
|
|
|
my $class = shift; |
|
44
|
0
|
|
|
|
|
|
@_; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
package MIME::Lite::TT::Provider; |
|
48
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
49
|
1
|
|
|
1
|
|
5
|
use base qw(Template::Provider); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
190
|
|
|
50
|
|
|
|
|
|
|
sub _load { |
|
51
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
52
|
0
|
|
|
|
|
|
my ($data, $error) = $self->SUPER::_load(@_); |
|
53
|
0
|
0
|
|
|
|
|
if(defined $data) { |
|
54
|
0
|
|
|
|
|
|
$data->{text} = utf8_upgrade($data->{text}); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
0
|
|
|
|
|
|
return ($data, $error); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
sub utf8_upgrade { |
|
59
|
0
|
|
|
0
|
|
|
my @list = map pack('U*', unpack 'U0U*', $_), @_; |
|
60
|
0
|
0
|
|
|
|
|
return wantarray ? @list : $list[0]; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
|
64
|
|
|
|
|
|
|
__END__ |