Skip to content
Permalink
Browse files

Fix a number of issues that arise when mod_perl is not installed.

  • Loading branch information...
martink committed Jul 13, 2012
1 parent b1bb15e commit 544a62d2be0f77ee1368cfbb8b321fcdf0b71683
@@ -1,5 +1,8 @@
use Plack::Builder;
use lib '/data/WebGUI/lib';

my $webgui_lib = '/data/WebGUI/lib';
use lib $webgui_lib, $webgui_lib.'/plebgui_mock';

use WebGUI;
WebGUI->init( root => '/data/WebGUI', config => 'dev.localhost.localdomain.conf' );

@@ -1,10 +1,8 @@
package WebGUI;


our $VERSION = '7.10.24';
our $STATUS = 'stable';


=head1 LEGAL
-------------------------------------------------------------------
@@ -20,13 +18,18 @@ our $STATUS = 'stable';
=cut

use strict;
use Apache2::Access ();
use Apache2::Const -compile => qw(OK DECLINED HTTP_UNAUTHORIZED SERVER_ERROR);
use Apache2::Request;
use Apache2::RequestIO;
use Apache2::RequestUtil ();
use Apache2::ServerUtil ();
use APR::Request::Apache2;

# Eval loading the mod_perl modules as they might not be installed when running under plack.
eval q{
require Apache2::Access ();
require Apache2::Request;
require Apache2::RequestIO;
require Apache2::RequestUtil ();
require Apache2::ServerUtil ();
require APR::Request::Apache2;
};

use MIME::Base64 ();
use Scalar::Util qw/blessed/;
use WebGUI::Config;
@@ -43,7 +43,7 @@ These subroutines are available from this package:

#-------------------------------------------------------------------

=head2 handler ( request, server, config )
=head2 handler ( request, server, config )
The Apache request handler for this package.
@@ -64,9 +64,12 @@ to the user, instead of displaying the Page Not Found page.
sub handler {
my ($request, $server, $config) = @_;
$request->push_handlers(PerlResponseHandler => sub {

my $request = shift;
$request = Apache2::Request->new($request);

if (! $request->isa('WebGUI::Session::Plack') ){
require Apache2::Request;
$request = Apache2::Request->new($request);
}

my $session = $request->pnotes('wgSession');

@@ -84,9 +87,9 @@ sub handler {
WebGUI::authen($request, split(":", MIME::Base64::decode_base64($auth), 2), $session);
}
else { # realm oriented
$request->push_handlers(PerlAuthenHandler => sub { return WebGUI::authen($request, undef, undef, $session)});
}
}
$request->push_handlers(PerlAuthenHandler => sub { return WebGUI::authen($request, undef, undef, $session)});
}
}

WebGUI::Asset::Template->processVariableHeaders($session);
foreach my $handler (@{$config->get("contentHandlers")}) {
@@ -0,0 +1,9 @@
package APR::Date;

use DateTime::Format::HTTP;

sub parse_http {
return DateTime::Format::HTTP->parse_datetime( shift )->epoch;
}

1;
@@ -0,0 +1,9 @@
package Apache2::Const;

sub OK { 1 }
sub DECLINED {1}
sub HTTP_UNAUTHORIZED {1}
sub SERVER_ERROR {1}


1;

0 comments on commit 544a62d

Please sign in to comment.
You can’t perform that action at this time.