blib/lib/Sledge/Template/TT/I18N.pm

filter: Statementstmt 50.0% 17 / 34 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 1 totaltotal 43.1% 22 / 51 CC 5 SCAR 16.9
CC
5
Cov
40%
output
12.0
_load
6.0
utf8_upgrade
6.0
CRAP 5.4
↑ Summary
1 package Sledge::Template::TT::I18N;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use base qw(Sledge::Template::TT);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 $VERSION = '0.01';
7  
8 0 ▶sub output {
Subroutine output: not called CC=3 SCAR=24.8
Pod undocumented
9 0 my $self = shift;
10 0 my %config = %{$self->{_options}};
11 0 my $input = delete $config{filename};
12 0 $config{LOAD_TEMPLATES} = [Sledge::Template::TT::I18N::Provider->new(\%config)];
13 0 my $template = Template->new(\%config);
14 0 ▶ unless (-e $input) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e $input) 0 0 0
15 0 Sledge::Exception::TemplateNotFound->throw(
16 "No template file detected. Check your template path.",
17 );
18 }
19 0 ▶ $template->process($input, $self->{_params}, \my $output)
Branch: 1 branch
BranchTrueFalseTotal
$template->process($input, $self->{"_params"}, \my $output) or "Sledge::Exception::TemplateParseError"->throw($template->error) 0 0 0
20 or Sledge::Exception::TemplateParseError->throw($template->error);
21 0 return $output;
22 }
23  
24 package Sledge::Template::TT::I18N::Provider;
25 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use base qw(Template::Provider);
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 0 ▶sub _load {
Subroutine _load: not called CC=2 SCAR=17.9
29 0 my $self = shift;
30  
31 0 my ($data, $error) = $self->SUPER::_load(@_);
32  
33 0 ▶ if(defined $data) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data) 0 0 0
34 0 $data->{text} = utf8_upgrade($data->{text});
35 }
36  
37 0 return ($data, $error);
38 }
39  
40 0 ▶sub utf8_upgrade {
Subroutine utf8_upgrade: not called CC=2 SCAR=17.9
41 0 my @list = map pack('U*', unpack 'U0U*', $_), @_;
42 0 ▶ return wantarray ? @list : $list[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
43 }
44  
45 1 1;
46 __END__
↑ Summary