Apply updates to make mod_perl work properly
This commit is contained in:
parent
8d8c58195d
commit
262427c776
30
index.cgi
30
index.cgi
@ -1,28 +1,35 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
# Note: above -w flag should be removed in production, as it will cause warnings in
|
# Note: above -w flag should be removed in production, as it will cause warnings in
|
||||||
# 3rd party modules to appear in the server error log
|
# 3rd party modules to appear in the server error log
|
||||||
|
# When running through mod_perl, remove the -T flag and use 'PerlSwitches -T'
|
||||||
|
# in the apache configuration.
|
||||||
|
|
||||||
use utf8;
|
use utf8;
|
||||||
use v5.12;
|
use v5.12;
|
||||||
use lib qw(/var/www/webperl);
|
use lib qw(/var/www/webperl);
|
||||||
use FindBin;
|
use FindBin;
|
||||||
|
|
||||||
# Work out where the script is, so module and config loading can work.
|
our ($scriptpath, $fallbackpath, $contact);
|
||||||
my $scriptpath;
|
|
||||||
|
# Handle very early startup tasks
|
||||||
BEGIN {
|
BEGIN {
|
||||||
if($FindBin::Bin =~ /(.*)/) {
|
# Modify these two defaults to suit your environment
|
||||||
|
$fallbackpath = "/var/www/vhosts/orb.starforge.co.uk/orb";
|
||||||
|
$contact = 'chris@starforge.co.uk';
|
||||||
|
|
||||||
|
# Location autodetect will fail under mod_perl, so use a hard-coded location.
|
||||||
|
if($ENV{MOD_PERL}) {
|
||||||
|
$scriptpath = $fallbackpath;
|
||||||
|
# Otherwise use the script's location as the script path
|
||||||
|
} elsif($FindBin::Bin =~ /(.*)/) {
|
||||||
$scriptpath = $1;
|
$scriptpath = $1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use CGI::Carp qw(fatalsToBrowser set_message); # Catch as many fatals as possible and send them to the user as well as stderr
|
|
||||||
|
|
||||||
use lib "$scriptpath/modules";
|
use lib "$scriptpath/modules";
|
||||||
|
|
||||||
my $contact = 'contact@email.address'; # global contact address, for error messages
|
# Catch as many fatals as possible and send them to the user as well as stderr
|
||||||
|
use CGI::Carp qw(fatalsToBrowser set_message);
|
||||||
# System modules
|
|
||||||
use CGI::Carp qw(fatalsToBrowser set_message); # Catch as many fatals as possible and send them to the user as well as stderr
|
|
||||||
|
|
||||||
# Webperl modules
|
# Webperl modules
|
||||||
use Webperl::Application;
|
use Webperl::Application;
|
||||||
@ -46,7 +53,8 @@ set_message(\&handle_errors);
|
|||||||
do {
|
do {
|
||||||
my $app = Webperl::Application -> new(appuser => ORB::AppUser -> new(),
|
my $app = Webperl::Application -> new(appuser => ORB::AppUser -> new(),
|
||||||
system => ORB::System -> new(),
|
system => ORB::System -> new(),
|
||||||
block_selector => ORB::BlockSelector -> new())
|
block_selector => ORB::BlockSelector -> new(),
|
||||||
|
config => "$scriptpath/config/config.cfg")
|
||||||
or die "Unable to create application";
|
or die "Unable to create application";
|
||||||
$app -> run();
|
$app -> run();
|
||||||
}
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user