| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Nephia::Plugin::View::Xslate; |
|
2
|
1
|
|
|
1
|
|
812
|
use 5.008005; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
34
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
27
|
|
|
4
|
1
|
|
|
1
|
|
13
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
5
|
1
|
|
|
1
|
|
756
|
use parent 'Nephia::Plugin'; |
|
|
1
|
|
|
|
|
281
|
|
|
|
1
|
|
|
|
|
5
|
|
|
6
|
|
|
|
|
|
|
use Text::Xslate; |
|
7
|
|
|
|
|
|
|
use Encode; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
|
12
|
|
|
|
|
|
|
my ($class, %opts) = @_; |
|
13
|
|
|
|
|
|
|
my $self = $class->SUPER::new(%opts); |
|
14
|
|
|
|
|
|
|
delete $opts{app}; |
|
15
|
|
|
|
|
|
|
$self->app->{stash} = {}; |
|
16
|
|
|
|
|
|
|
$self->app->{view} = Text::Xslate->new(%opts); |
|
17
|
|
|
|
|
|
|
return $self; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub exports { qw/ render / }; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub render { |
|
23
|
|
|
|
|
|
|
my ($self, $context) = @_; |
|
24
|
|
|
|
|
|
|
return sub ($;$) { |
|
25
|
|
|
|
|
|
|
my ($template, $args) = @_; |
|
26
|
|
|
|
|
|
|
my $content = $self->app->{view}->render($template, $args); |
|
27
|
|
|
|
|
|
|
Encode::encode_utf8($content); |
|
28
|
|
|
|
|
|
|
}; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
|
32
|
|
|
|
|
|
|
__END__ |