| 1 | package Terse::View::TT; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = 0.04; | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use base qw/Terse::View/; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Template; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub build_view { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_view: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | my ($self, $config) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | $config = $self->app_config = { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | EVAL_PERL => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | INCLUDE_PATH => 'root/src', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | TEMPLATE_EXTENSION => 'tt', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | CLASS => 'Template', | ||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | %{ $config } | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | $self->{template} = $config->{CLASS}->new($config); | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub render { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my ($self, $t, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $template = $data->{template}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | if (!$template) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | $template = $t->response_namespace; | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | my $handler = $t->response_handler; | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | if ($template !~ m/$handler$/) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $template .= '/' . $handler; | |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | $template .= '.' . $self->app_config->TEMPLATE_EXTENSION; | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | unless ($template) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | return $self->can('handle_error') ? $self->handle_error('Error - Cannot find template') : ('text/html', '<p>Error - Cannot find template</p>'); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | $self->template->{SERVICE}->{WRAPPER} = ($data->{NO_WRAPPER} || (!$data->WRAPPER && ! $self->app_config->WRAPPER)) | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$data->{"NO_WRAPPER"} or not $data->WRAPPER || $self->app_config->WRAPPER
$data->WRAPPER || $self->app_config->WRAPPER
$data->WRAPPER || $self->app_config->WRAPPER
MC/DC0%0/3
$data->{"NO_WRAPPER"} or not $data->WRAPPER || $self->app_config->WRAPPER
$data->{"NO_WRAPPER"}
$data->WRAPPER
$self->app_config->WRAPPER
Truth table0%0/4
A or not(B || C)
A= $data->{"NO_WRAPPER"}B= $data->WRAPPERC= $self->app_config->WRAPPER
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ? [] | ||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | : [($data->WRAPPER || $self->app_config->WRAPPER) . '.' . $self->app_config->TEMPLATE_EXTENSION]; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my $output = eval { $self->render_template($template, $data) }; | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | return $self->can('handle_error') ? $self->handle_error($@) : ('text/html', $@); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | return ('text/html', $output); | |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub render_template { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render_template: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my ($self, $template, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $output; | |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | unless ($self->template->process( $template, {%{$data}}, \$output )) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | die $self->template->error; | |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||