Serialize/Data/Serializer.pm

filter: Statementstmt 93.1% 27 / 29 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 85.3% 35 / 41 CC 4 SCAR 10.4
CC
4
Cov
86%
execute
4.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« Deserialize/Data/Serializer.pm ↑ Summary
1 package Catalyst::Action::Serialize::Data::Serializer;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 extends 'Catalyst::Action';
7 1 ▶use Data::Serializer;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = '1.08';
10 1 $VERSION = eval $VERSION;
11  
12 7 ▶sub execute {
Subroutine execute: called CC=4 SCAR=14.4
Pod documented
13 7 my $self = shift;
14 7 my ( $controller, $c, $serializer ) = @_;
15  
16 my $stash_key = (
17 $controller->{'serialize'} ?
18 $controller->{'serialize'}->{'stash_key'} :
19 7 ▶ $controller->{'stash_key'}
Branch: 1 branch
BranchTrueFalseTotal
$controller->{'serialize'} ? : 0 7 7
Condition50%1/2
($controller->{'serialize'} ? $controller->{'serialize'}{'stash_key'} : $controller->{'stash_key'}) || 'rest'
l!l
70
MC/DC0%0/1
($controller->{'serialize'} ? $controller->{'serialize'}{'stash_key'} : $controller->{'stash_key'}) || 'rest'
($controller->{'serialize'} ? $controller->{'serialize'}{'stash_key'} : $controller->{'stash_key'})
Truth table50%1/2
A
A= ($controller->{'serialize'} ? $controller->{'serialize'}{'stash_key'} : $controller->{'stash_key'})
Aresult
11
00
20 ) || 'rest';
21 7 my $sp = $serializer;
22 7 $sp =~ s/::/\//g;
23 7 $sp .= ".pm";
24 7 eval {
25 7 require $sp
26 };
27 7 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 7 7
28 0 $c->log->info("Could not load $serializer, refusing to serialize: $@");
29 0 return;
30 }
31 7 my $dso = Data::Serializer->new( serializer => $serializer );
32 7 my $data = $dso->raw_serialize($c->stash->{$stash_key});
33 7 $c->response->output( $data );
34 7 return 1;
35 }
36  
37 1 __PACKAGE__->meta->make_immutable;
38  
39 1 1;
40  
41 __END__
« Deserialize/Data/Serializer.pm ↑ Summary