line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Spoon::Template::Mason; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
801
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
5
|
1
|
|
|
1
|
|
461
|
use Spoon 0.23; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Spoon::Template '-base'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Cwd (); |
9
|
|
|
|
|
|
|
use HTML::Mason::Interp; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use vars qw ($VERSION); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$VERSION = 0.05; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
field 'interp' => |
16
|
|
|
|
|
|
|
-init => '$self->_make_interp'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub render |
19
|
|
|
|
|
|
|
{ |
20
|
|
|
|
|
|
|
my $self = shift; |
21
|
|
|
|
|
|
|
my $comp = shift; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$comp = "/$comp" unless $comp =~ m{^/}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $output = ''; |
26
|
|
|
|
|
|
|
$self->interp->out_method(\$output); |
27
|
|
|
|
|
|
|
$self->interp->exec( $comp, $self->all, @_ ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return $output; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#method private make_interp => sub |
33
|
|
|
|
|
|
|
sub _make_interp |
34
|
|
|
|
|
|
|
{ |
35
|
|
|
|
|
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
my $params = shift || {}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $root_name = 'root001'; |
39
|
|
|
|
|
|
|
my $path = $self->path; |
40
|
|
|
|
|
|
|
my @roots = map { [ $root_name++ => Cwd::abs_path($_) ] } ref $path ? @$path : $path; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $interp = |
43
|
|
|
|
|
|
|
HTML::Mason::Interp->new |
44
|
|
|
|
|
|
|
( comp_root => \@roots, |
45
|
|
|
|
|
|
|
%$params, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$self->interp($interp); |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |