lib/Reaction/UI/LayoutSet/TT.pm

filter: Statementstmt 100% 29 / 29 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 88.3% 38 / 43 CC 4 SCAR 8.6
CC
4
Cov
91%
_build_tt_view
4.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.4
« lib/Reaction/UI/ViewPort/Collection/Grid.pm ↑ Summary lib/Reaction/UI/ViewPort/Action/Role/Close.pm »
1 package Reaction::UI::LayoutSet::TT;
2  
3 3 ▶use Reaction::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use aliased 'Reaction::UI::LayoutSet';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use aliased 'Template::View';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use namespace::clean -except => [ qw(meta) ];
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 extends LayoutSet;
9  
10  
11  
12 3 has 'tt_view' => (is => 'rw', isa => View, lazy_fail => 1);
13 22 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
14 22 my ($self, $args) = @_;
15  
16 # Do this at build time rather than on demand so any exception if it
17 # goes wrong gets thrown sometime sensible
18  
19 22 $self->tt_view($self->_build_tt_view($args));
20 };
21 22 ▶sub _build_tt_view {
Subroutine _build_tt_view: called CC=4 SCAR=14.1
22 22 my ($self, $args) = @_;
23 my $tt_object = $args->{tt_object}
24 22 ▶ || confess "tt_object not provided to new()";
Condition50%1/2
$args->{'tt_object'} || confess('tt_object not provided to new()')
l!l
220
MC/DC0%0/1
$args->{'tt_object'} || confess('tt_object not provided to new()')
$args->{'tt_object'}
Truth table50%1/2
A
A= $args->{'tt_object'}
Aresult
11
00
25 22 my $tt_args = { data => {} };
26 22 my $name = $self->name;
27 22 $name =~ s/\//__/g; #slashes are not happy here...
28 22 my $layouts = $self->layouts;
29  
30 my $tt_source = join("\n", "[%- VIEW ${name};",
31 22 (map {("BLOCK $_; -%]" . $layouts->{$_} ."[%- END;") } keys %$layouts),
32 "END; # End view\ndata.view = ${name}; -%]" );
33  
34 22 ▶ $tt_object->process(\$tt_source, $tt_args)
Branch: 1 branch
BranchTrueFalseTotal
$tt_object->process(\$tt_source, $tt_args) or confess('Template processing error: ' . $tt_object->error . " processing:\n$tt_source") 22 0 22
35 || confess "Template processing error: ".$tt_object->error
36 ." processing:\n${tt_source}";
37 confess "View template processed but no view object found"
38 ." after processing:\n${tt_source}"
39 22 ▶ unless $tt_args->{data}{view};
Branch: 1 branch
BranchTrueFalseTotal
unless $tt_args->{"data"}{"view"} 0 22 22
40 22 return $tt_args->{data}{view};
41 };
42  
43 3 __PACKAGE__->meta->make_immutable;
44  
45  
46 3 1;
« lib/Reaction/UI/ViewPort/Collection/Grid.pm ↑ Summary lib/Reaction/UI/ViewPort/Action/Role/Close.pm »