| 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
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 1 | 1; | |||||||||
| 46 | __END__ | ||||||||||