ASP4/HTTPHandler.pm

filter: Statementstmt 32.8% 23 / 70 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 47.0% 8 / 17 Podpod 0.0% 0 / 7 totaltotal 31.3% 31 / 99 CC 3 SCAR 7.8
CC
3
Cov
31%
properties
6.0
init_asp_objects
5.0
new
2.0
CRAP 2.2
« ASP4/ConfigNode.pm ↑ Summary ASP4.pm »
1  
2 package ASP4::HTTPHandler;
3  
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Data::Properties::YAML;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 BEGIN {
9 sub VARS {
10 3 ▶ qw(
Subroutine VARS: called CC=1 SCAR=0.0
Pod undocumented
11 $Request $Response
12 $Session $Server
13 $Config $Form
14 $Stash
15 )
16 }
17 3 ▶ use vars __PACKAGE__->VARS;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
18 }
19  
20  
21 sub new {
22 0 ▶ my ($class, %args) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
23 0 return bless \%args, $class;
24 }
25  
26  
27 0 ▶sub before_run { 1; }
Subroutine before_run: not called CC=1 SCAR=6.9
Pod undocumented
28 ▶sub after_run { }
Subroutine after_run: not called CC=1 SCAR=0.0
Pod undocumented
29  
30  
31 sub init_asp_objects
32 {
33 0 ▶ my ($s, $context) = @_;
Subroutine init_asp_objects: not called CC=2 SCAR=16.1
Pod undocumented
34
35 0 $Request = $context->request;
36 0 $Response = $context->response;
37 0 $Session = $context->session;
38 0 $Server = $context->server;
39 0 $Form = $context->request->Form;
40 0 $Config = $context->config;
41 0 $Stash = $context->stash;
42
43 0 ▶ my $class = ref($s) ? ref($s) : $s;
Branch: 1 branch
BranchTrueFalseTotal
ref $s ? : 0 0 0
44 0 my @classes = $s->_parents( $class );
45 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
46 0 my %saw = ( );
47 map {
48 0 ${"$_\::Request"} = $Request;
49 0 ${"$_\::Response"} = $Response;
50 0 ${"$_\::Session"} = $Session;
51 0 ${"$_\::Server"} = $Server;
52 0 ${"$_\::Form"} = $Form;
53 0 ${"$_\::Config"} = $Config;
54 0 ${"$_\::Stash"} = $Stash;
55 0 } grep { ! $saw{$_}++ } @classes;
56
57 0 return 1;
58 }# end init_asp_objects()
59  
60  
61 sub properties
62 {
63 0 ▶ my ($s, $file) = @_;
Subroutine properties: not called CC=2 SCAR=17.9
Pod undocumented
64
65 0 ▶ $file ||= $Config->web->application_root . '/etc/properties.yaml';
Condition0%0/2
$file ||= $ASP4::HTTPHandler::Config->web->application_root . '/etc/properties.yaml'
l!l
00
MC/DC0%0/1
$file ||= $ASP4::HTTPHandler::Config->web->application_root . '/etc/properties.yaml'
$file
Truth table0%0/2
A
A= $file
Aresult
11
00
66 0 return Data::Properties::YAML->new( properties_file => $file );
67 }# end properties()
68  
69 sub trim_form
70 {
71 3 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
72
73 map {
74 0 ▶ $Form->{$_} =~ s/^\s+//;
Subroutine trim_form: not called CC=1 SCAR=6.9
Pod undocumented
75 0 $Form->{$_} =~ s/\s+$//;
76 } keys %$Form;
77 }# end trim()
78  
79  
80 sub _parents
81 {
82 0 ▶ my ($s, $class ) = @_;
Subroutine _parents: not called CC=1 SCAR=3.3
83
84 0 my @classes = ( $class );
85 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
86 0 my $pkg = __PACKAGE__;
87 0 push @classes, map { $s->_parents( $_ ) }
88 0 grep { $_->isa($pkg) }
89 0 @{"$class\::ISA"};
90
91 0 return @classes;
92 }# end _parents()
93  
94  
95 sub DESTROY
96 {
97 0 ▶ my $s = shift;
Subroutine DESTROY: not called CC=1 SCAR=6.9
98 0 undef(%$s);
99 }# end DESTROY()
100  
101 3 1;# return true:
102  
« ASP4/ConfigNode.pm ↑ Summary ASP4.pm »