# number 'die' was called in.
use constant END_OF_REQUEST => "END-OF-REQUEST\n";
+sub new {
+ my ($class, $interface) = @_;
+
+ my $self = bless {}, $class;
+ $self->{interface} = lc($interface || 'cgi');
+
+ return $self;
+}
+
sub pre_request_checks {
if (!$::auth->session_tables_present) {
if ($::form->{script} eq 'admin.pl') {
}
sub handle_request {
+ my $self = shift;
+
$::lxdebug->enter_sub;
$::lxdebug->begin_request;
- my $interface = lc(shift || 'cgi');
my ($script, $path, $suffix, $script_name, $action, $routing_type);
$script_name = $ENV{SCRIPT_NAME};
- unrequire_bin_mozilla($interface);
+ $self->unrequire_bin_mozilla;
$::cgi = CGI->new('');
$::locale = Locale->new($::language);
}
sub unrequire_bin_mozilla {
- return unless $_[0] =~ m/^(?:fastcgi|fcgid|fcgi)$/;
+ my $self = shift;
+ return unless $self->{interface} =~ m/^(?:fastcgi|fcgid|fcgi)$/;
for (keys %INC) {
next unless m#^bin/mozilla/#;
use SL::Dispatcher;
-SL::Dispatcher::pre_startup();
-SL::Dispatcher::handle_request('CGI');
+my $dispatcher = SL::Dispatcher->new('CGI');
+$dispatcher->pre_startup;
+$dispatcher->handle_request;
1;
SL::FCGIFixes::apply_fixes();
-SL::Dispatcher::pre_startup();
+my $dispatcher = SL::Dispatcher->new('FastCGI');
+$dispatcher->pre_startup;
+
my $request = FCGI::Request();
-SL::Dispatcher::handle_request('FastCGI') while $request->Accept() >= 0;
+$dispatcher->handle_request($request) while $request->Accept() >= 0;
1;