line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Email::MIME::MobileJP::Template; |
2
|
1
|
|
|
1
|
|
18313
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
4
|
1
|
|
|
1
|
|
3
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
453
|
use Tiffany; |
|
1
|
|
|
|
|
280
|
|
|
1
|
|
|
|
|
24
|
|
7
|
1
|
|
|
1
|
|
358
|
use Email::MIME::MobileJP::Creator; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
|
|
|
|
|
|
my ( $class, $name, $args ) = @_; |
11
|
|
|
|
|
|
|
my $tiffany = Tiffany->load( $name, $args ); |
12
|
|
|
|
|
|
|
return bless { tiffany => $tiffany }, $class; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub render { |
16
|
|
|
|
|
|
|
my ( $self, $to, $tmpl, @args ) = @_; |
17
|
|
|
|
|
|
|
Carp::croak('Usage: $tmpl->render($to, $tmpl[, @args])') unless defined $tmpl; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $creator = Email::MIME::MobileJP::Creator->new($to); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my @lines = split /\n/, $self->{tiffany}->render( $tmpl, @args ); |
22
|
|
|
|
|
|
|
while ( @lines > 0 && $lines[0] =~ /^([A-Z][A-Za-z_-]+)\s*:\s*(.+?)$/ ) { |
23
|
|
|
|
|
|
|
my ( $key, $val ) = ( $1, $2 ); |
24
|
|
|
|
|
|
|
$creator->header($key, $val); |
25
|
|
|
|
|
|
|
shift @lines; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
if ( @lines > 0 && $lines[0] =~ /^\s*$/ ) { |
28
|
|
|
|
|
|
|
shift @lines; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
$creator->body( join( "\n", @lines) ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
return $creator->finalize(); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
__END__ |