ApacheMP2.pm 956 Bytes
Newer Older
Yadd's avatar
Yadd committed
1 2 3
# LLNG platform class for Apache-2/ModPerl-2
#
# See http://lemonldap-ng.org/documentation/latest/handlerarch
Yadd's avatar
Yadd committed
4 5 6
package Lemonldap::NG::Handler::ApacheMP2;

use strict;
7
use Lemonldap::NG::Handler::ApacheMP2::Request;
Yadd's avatar
Yadd committed
8

Yadd's avatar
Yadd committed
9
use Lemonldap::NG::Handler::ApacheMP2::Main;
Yadd's avatar
Yadd committed
10 11 12 13 14 15

our $VERSION = '2.0.0';

# PUBLIC METHODS

sub handler {
Yadd's avatar
Yadd committed
16
    shift if ($#_);
17
    return launch( 'run', @_ );
Yadd's avatar
Yadd committed
18 19 20 21
}

sub logout {
    shift if ($#_);
22
    return launch( 'unlog', @_ );
Yadd's avatar
Yadd committed
23 24 25 26
}

sub status {
    shift if ($#_);
27
    return launch( 'getStatus', @_ );
Yadd's avatar
Yadd committed
28 29 30
}

# Internal method to get class to load
31 32 33 34
sub launch {
    my ( $sub, $r ) = @_;
    my $req  = Lemonldap::NG::Handler::Apache2::Request->new($r);
    my $type = Lemonldap::NG::Handler::ApacheMP2::Main->checkType($req);
35 36 37
    if ( my $t = $_[0]->dir_config('VHOSTTYPE') ) {
        $type = $t;
    }
Yadd's avatar
Yadd committed
38 39
    my $class = "Lemonldap::NG::Handler::ApacheMP2::$type";
    eval "require $class";
Yadd's avatar
Yadd committed
40
    die $@ if ($@);
41
    return $class->$sub($req);
Yadd's avatar
Yadd committed
42 43 44
}

1;