#!/usr/bin/perl ############################################################################################ # Change the first line of this file if the path to your perl is not /usr/bin/perl # Example: #!/usr/local/bin/perl ############################################################################################ # Standard script wrapper for scripts in a subdirectory of the main application directory. # Author: Daniel Dinev; All rights reserved (c) 2001; http://www.chatologica.com/ ############################################################################################ use strict; # make Perl more strict to code $^W = 1; # enable warnings $| = 1; # do not buffer the script output use vars qw($P $MODIFIED $HAVE_TO_CHDIR); BEGIN { # Now making the current working directory to be the directory where this script resides. # This is needed usually if the web server is IIS on Windows platform! my $path = $0; # $0 is the full path to this script if($path =~ m{^(.*)[/\\][^/\\]+$}) { # remove script filename from the path $path = $1; chdir($path) || # move to the directory of this file print "Content-type: text/html\n\nCan't navigate to '$path' directory: $!"; }; chdir '../' || print "Content-type: text/html\n\nCan't chdir '../'"; $HAVE_TO_CHDIR = 0; }; if($HAVE_TO_CHDIR){ # because of mod_perl: have to chdir on every request my $path = $0; # $0 is the full path to this script if($path =~ m{^(.*)[/\\][^/\\]+$}) { # remove script filename from the path $path = $1; chdir($path) || # move to the directory of this file print "Content-type: text/html\n\nCan't navigate to '$path' directory: $!"; }; chdir '../' || print "Content-type: text/html\n\nCan't chdir '../'"; }; $HAVE_TO_CHDIR = 1; use lib qw(.); use MTS4::STD::MyCarp; # make error messages appear on browser window use MTS4::STD::CGI_Request; my $r = new MTS4::STD::CGI_Request(admin => 1); $r->process; # process this cgi request