| 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
Condition50%1/2
(ref $c->config->{'debug'} eq 'HASH' ? $c->config->{'debug'}{'ignore_classes'} : undef) || ['DBIx::Class::ResultSource::Table', 'DBIx::Class::ResultSourceHandle', 'DateTime']
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)
| |||||||||||||||||||||||||||||||||
| 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
Condition33%1/3
(ref $c->config->{'debug'} eq 'HASH' ? $c->config->{'debug'}{'scrubber_func'} : undef) || sub {
$_ = '[stringified to: ' . $_ . ']';
}
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: ' . $_ . ']';
}
| |||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | 4 | ▶ | if ($c->debug && $c->req->params->{dump_info}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$c->debug and $c->req->params->{"dump_info"}
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"}
| |||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | unless ( keys %ignore_classes ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 52 | 4 | ▶ | return 1 if defined $c->response->body; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 53 | 2 | ▶ | return 1 if scalar @{ $c->error } && !$c->stash->{template}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
scalar @{$c->error;} and not $c->stash->{"template"}
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"}
| |||||||||||||||||||||||||||||||||
| 54 | 2 | ▶ | return 1 if $c->response->status =~ /^(?:204|3\d\d)$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 55 | 2 | ▶ | my $view = $c->view() | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$c->view || die("Catalyst::Action::RenderView could not find a view to forward to.\n")
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
| |||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||