Navigator/View/TT2.pm

filter: Statementstmt 71.8% 23 / 32 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 1 totaltotal 67.4% 29 / 43 CC 2 SCAR 8.0
CC
2
Cov
68%
render
6.0
__ANON__
2.0
BEGIN
1.0
CRAP 2.2
« Navigator/Node/DBI.pm ↑ Summary Navigator/Node/Win32/Registry.pm »
1 package Tree::Navigator::View::TT2;
2 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 1 extends 'Tree::Navigator::View';
12 1 has 'tt' => ( is => 'ro', isa => 'Template' );
13 1 has 'input' => ( is => 'ro' );
14  
15 0 ▶around 'BUILDARGS' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
16 0 my $parent_buildargs = shift;
17 0 my $class = shift;
18 0 my $input = shift;
19 0 my $template_args = $class->$parent_buildargs(@_);
20  
21 0 return {tt => Template->new(%$template_args),
22 input => $input};
23  
24 # TODO: also take args from $tn->config
25 1 };
26  
27  
28  
29 0 ▶sub render {
Subroutine render: not called CC=2 SCAR=17.9
Pod undocumented
30 0 my ($self, $node, $request) = @_;
31  
32 0 my $values = { node => $node,
33 data => $node->data,
34 request => $request };
35 0 ▶ $self->tt->process($self->input, $values, \my $output)
Branch: 1 branch
BranchTrueFalseTotal
$self->tt->process($self->input, $values, \my $output) or return [500, ["Content-type", "text/plain"], [$self->tt->error->as_string]] 0 0 0
36 or return [500, ['Content-type' => 'text/plain'],
37 [$self->tt->error->as_string] ];
38  
39 0 return [200, ['Content-type' => 'text/html'], [$output] ];
40  
41 # TODO: extend API to choose other content-type and maybe add other headers
42 }
43  
44  
45 1 1; # end of package Tree::Navigator::View::TT2
46  
47 __END__
« Navigator/Node/DBI.pm ↑ Summary Navigator/Node/Win32/Registry.pm »