Plagger/Template.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 46 CC 2 SCAR 11.0
CC
2
Cov
0%
new
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.0
1 package Plagger::Template;
2 use strict;
3 use base qw( Template );
4  
5 use FindBin;
6 use File::Spec::Functions qw(catfile);
7  
8 use Template::Provider::Encoding 0.04;
9 use Template::Stash::ForceUTF8;
10  
11 sub new {
12 my($class, $context, $plugin) = @_;
13  
14 my $path = $context->conf->{assets_path} || catfile($FindBin::Bin, "assets");
15 my $paths = [ catfile($path, "plugins", $plugin->class_id),
16 catfile($path, "common") ];
17  
18 if ($plugin->conf->{assets_path}) {
19 unshift @$paths, $plugin->conf->{assets_path};
20 }
21  
22 $context->log(debug => "Assets path: " . join(":", @$paths));
23  
24 return $class->SUPER::new({
25 INCLUDE_PATH => $paths,
26 LOAD_TEMPLATES => [
27 Template::Provider::Encoding->new({ INCLUDE_PATH => $paths }),
28 ],
29 STASH => Template::Stash::ForceUTF8->new,
30 PLUGIN_BASE => [ 'Plagger::TT' ],
31 });
32 }
33  
34 1;
35  
36 __END__