Lemonldap/NG/Handler/ApacheMP2.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 82 CC 9 SCAR 29.8
CC
9
Cov
0%
launch
42.0
handler
6.0
logout
6.0
CRAP 19.6
1 # LLNG platform class for Apache-2/ModPerl-2
2 #
3 # See https://lemonldap-ng.org/documentation/latest/handlerarch
4 package Lemonldap::NG::Handler::ApacheMP2;
5  
6 use strict;
7 use Lemonldap::NG::Handler::ApacheMP2::Request;
8  
9 use Lemonldap::NG::Handler::ApacheMP2::Main;
10  
11 our $VERSION = '2.19.0';
12  
13 # PUBLIC METHODS
14  
15 sub handler {
16 shift if ($#_);
17 return launch( 'run', @_ );
18 }
19  
20 sub logout {
21 shift if ($#_);
22 return launch( 'unlog', @_ );
23 }
24  
25 sub reload {
26 shift if ($#_);
27 return launch( 'reload', @_ );
28 }
29  
30 # Internal method to get class to load
31 sub launch {
32 my ( $sub, $r ) = @_;
33 my $req = Lemonldap::NG::Handler::ApacheMP2::Request->new($r);
34 my $type = Lemonldap::NG::Handler::ApacheMP2::Main->checkType($req);
35 if ( my $t = $r->dir_config('VHOSTTYPE') ) {
36 $type = $t;
37 }
38 my $class = "Lemonldap::NG::Handler::ApacheMP2::$type";
39 Lemonldap::NG::Handler::Main->buildAndLoadType($class);
40  
41 # register the request object to the logging system
42 if ( ref( $class->logger ) and $class->logger->can('setRequestObj') ) {
43 $class->logger->setRequestObj($req);
44 }
45 if ( ref( $class->userLogger )
46 and $class->userLogger->can('setRequestObj') )
47 {
48 $class->userLogger->setRequestObj($req);
49 }
50  
51 $class->logger->info(
52 "New request $class " . $req->method . " " . $req->request_uri );
53  
54 my ($res) = $class->$sub($req);
55  
56 # Clear the logging system before the next request
57 if ( ref( $class->logger ) and $class->logger->can('clearRequestObj') ) {
58 $class->logger->clearRequestObj($req);
59 }
60 if ( ref( $class->userLogger )
61 and $class->userLogger->can('clearRequestObj') )
62 {
63 $class->userLogger->clearRequestObj($req);
64 }
65 return $res;
66 }
67  
68 1;