Added example webapp index file.
This commit is contained in:
parent
9e2b79112f
commit
39ccfc6775
33
supportfiles/webapp/index.cgi
Normal file
33
supportfiles/webapp/index.cgi
Normal file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/perl -wT
|
||||
|
||||
use strict;
|
||||
use lib qw(/path/to/webperl);
|
||||
use lib qw(modules);
|
||||
use utf8;
|
||||
|
||||
# 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
|
||||
use AppUser::YourApp;
|
||||
use Application;
|
||||
|
||||
my $contact = 'contact@email.address'; # global contact address, for error messages
|
||||
|
||||
# install more useful error handling
|
||||
BEGIN {
|
||||
$ENV{"PATH"} = ""; # Force no path.
|
||||
|
||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Clean up ENV
|
||||
sub handle_errors {
|
||||
my $msg = shift;
|
||||
print "<h1>Software error</h1>\n";
|
||||
print '<p>Server time: ',scalar(localtime()),'<br/>Error was:</p><pre>',$msg,'</pre>';
|
||||
print '<p>Please report this error to ',$contact,' giving the text of this error and the time and date at which it occured</p>';
|
||||
}
|
||||
set_message(\&handle_errors);
|
||||
}
|
||||
|
||||
my $app = Application -> new(appuser => AppUser::YourApp -> new())
|
||||
or die "Unable to create application";
|
||||
$app -> run();
|
Loading…
x
Reference in New Issue
Block a user