blib/lib/Catalyst/Action/RenderView.pm

filter: Statementstmt 80.4% 33 / 41 Branchbran 59.0% 13 / 22 Conditioncond 38.4% 5 / 13 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 63.0% 58 / 92 CC 18 SCAR 35.0
CC
18
Cov
67%
execute
43.9
__ANON__
2.0
BEGIN
1.0
CRAP 33.3
↑ Summary
1 package Catalyst::Action::RenderView;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 our $VERSION = '0.17';
7  
8 3 ▶use base 'Catalyst::Action';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 ▶use MRO::Compat;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use Data::Visitor::Callback;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 my %ignore_classes = ();
14  
15 4 ▶sub execute {
Subroutine execute: called CC=18 SCAR=37.8
Pod documented
16 4 my $self = shift;
17 4 my ($controller, $c ) = @_;
18 4 $self->next::method( @_ );
19  
20 $c->config->{'Action::RenderView'}->{ignore_classes} =
21 ( ref($c->config->{'debug'}) eq 'HASH' ? $c->config->{'debug'}->{ignore_classes} : undef )
22 || [ qw/
23 DBIx::Class::ResultSource::Table
24 DBIx::Class::ResultSourceHandle
25 DateTime
26 4 ▶ / ] unless exists $c->config->{'Action::RenderView'}->{ignore_classes};
Branch: 2 branches
BranchTrueFalseTotal
unless exists $c->config->{"Action::RenderView"}{"ignore_classes"} 1 3 4
ref $c->config->{'debug'} eq 'HASH' ? : 0 1 1
Condition50%1/2
(ref $c->config->{'debug'} eq 'HASH' ? $c->config->{'debug'}{'ignore_classes'} : undef) || ['DBIx::Class::ResultSource::Table', 'DBIx::Class::ResultSourceHandle', 'DateTime']
l!l
01
MC/DC0%0/1
(ref $c->config->{'debug'} eq 'HASH' ? $c->config->{'debug'}{'ignore_classes'} : undef) || ['DBIx::Class::ResultSource::Table', 'DBIx::Class::ResultSourceHandle', 'DateTime']
(ref $c->config->{'debug'} eq 'HASH' ? $c->config->{'debug'}{'ignore_classes'} : undef)
Truth table50%1/2
A
A= (ref $c->config->{'debug'} eq 'HASH' ? $c->config->{'debug'}{'ignore_classes'} : undef)
Aresult
11
00
27  
28 $c->config->{'Action::RenderView'}->{scrubber_func} =
29 ( ref($c->config->{'debug'}) eq 'HASH' ? $c->config->{'debug'}->{scrubber_func} : undef )
30 0 ▶ || sub { $_='[stringified to: ' . $_ . ']' }
Subroutine __ANON__: not called CC=1 SCAR=6.9
31 4 ▶ unless exists $c->config->{'Action::RenderView'}->{scrubber_func};
Branch: 2 branches
BranchTrueFalseTotal
unless exists $c->config->{"Action::RenderView"}{"scrubber_func"} 1 3 4
ref $c->config->{'debug'} eq 'HASH' ? : 0 1 1
Condition33%1/3
(ref $c->config->{'debug'} eq 'HASH' ? $c->config->{'debug'}{'scrubber_func'} : undef) || sub { $_ = '[stringified to: ' . $_ . ']'; }
l!l&&r!l&&!r
010
MC/DC0%0/2
(ref $c->config->{'debug'} eq 'HASH' ? $c->config->{'debug'}{'scrubber_func'} : undef) || sub { $_ = '[stringified to: ' . $_ . ']'; }
(ref $c->config->{'debug'} eq 'HASH' ? $c->config->{'debug'}{'scrubber_func'} : undef) sub { $_ = '[stringified to: ' . $_ . ']'; }
Truth table33%1/3
A || B
A= (ref $c->config->{'debug'} eq 'HASH' ? $c->config->{'debug'}{'scrubber_func'} : undef)B= sub { $_ = '[stringified to: ' . $_ . ']'; }
ABresult
1X1
011
000
32  
33 4 ▶ if ($c->debug && $c->req->params->{dump_info}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->debug and $c->req->params->{"dump_info"}) 0 4 4
Condition33%1/3
$c->debug and $c->req->params->{"dump_info"}
!ll&&!rl&&r
400
MC/DC0%0/2
$c->debug and $c->req->params->{"dump_info"}
$c->debug $c->req->params->{"dump_info"}
Truth table33%1/3
A and B
A= $c->debugB= $c->req->params->{"dump_info"}
ABresult
0X0
100
111
34 0 ▶ unless ( keys %ignore_classes ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (keys %ignore_classes) 0 0 0
35 0 foreach my $class (@{$c->config->{'Action::RenderView'}->{ignore_classes}}) {
36 0 $ignore_classes{$class} = $c->config->{'Action::RenderView'}->{scrubber_func};
37 }
38 }
39 0 my $scrubber=Data::Visitor::Callback->new(
40 "ignore_return_values" => 1,
41 "object" => "visit_ref",
42 %ignore_classes,
43 );
44 0 $scrubber->visit( $c->stash );
45 0 die('Forced debug - Scrubbed output');
46 }
47  
48 4 ▶ if(! $c->response->content_type ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($c->response->content_type) 4 0 4
49 4 $c->response->content_type( 'text/html; charset=utf-8' );
50 }
51 4 ▶ return 1 if $c->req->method eq 'HEAD';
Branch: 1 branch
BranchTrueFalseTotal
if $c->req->method eq "HEAD" 0 4 4
52 4 ▶ return 1 if defined $c->response->body;
Branch: 1 branch
BranchTrueFalseTotal
if defined $c->response->body 2 2 4
53 2 ▶ return 1 if scalar @{ $c->error } && !$c->stash->{template};
Branch: 1 branch
BranchTrueFalseTotal
if scalar @{$c->error;} and not $c->stash->{"template"} 0 2 2
Condition33%1/3
scalar @{$c->error;} and not $c->stash->{"template"}
!ll&&!rl&&r
200
MC/DC0%0/2
scalar @{$c->error;} and not $c->stash->{"template"}
scalar @{$c->error;} not $c->stash->{"template"}
Truth table33%1/3
A and not(B)
A= scalar @{$c->error;}B= not $c->stash->{"template"}
ABresult
0X0
100
111
54 2 ▶ return 1 if $c->response->status =~ /^(?:204|3\d\d)$/;
Branch: 1 branch
BranchTrueFalseTotal
if $c->response->status =~ /^(?:204|3\d\d)$/ 0 2 2
55 2 ▶ my $view = $c->view()
Condition50%1/2
$c->view || die("Catalyst::Action::RenderView could not find a view to forward to.\n")
l!l
20
MC/DC0%0/1
$c->view || die("Catalyst::Action::RenderView could not find a view to forward to.\n")
$c->view
Truth table50%1/2
A
A= $c->view
Aresult
11
00
56 || die "Catalyst::Action::RenderView could not find a view to forward to.\n";
57 2 $c->forward( $view );
58 };
59  
60 3 1;
61  
62 __END__
↑ Summary