source: main/trunk/greenstone2/common-src/cgi-bin/index-server.pl@ 31960

Last change on this file since 31960 was 24872, checked in by ak19, 12 years ago

First set of changes to do with migration of cgi-bin into common-src, so that upon make install, common-src\cgi-bin will be installed in cgi-bin\GSDLOS(GSDLARCH). After this commit (to do with the contents of the files), cgi-bin itself will be moved.

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/usr/bin/perl -w
2##!C:\\Perl\\bin\\perl -w
3# If not explicitly associating .pl filename ending with Perl in the
4# web server's configuration file, then need to specify the full path of
5# Perl above
6
7use strict;
8
9BEGIN {
10 # Line to stop annoying child DOS CMD windows from appearing
11 Win32::SetChildShowWindow(0)
12 if defined &Win32::SetChildShowWindow;
13}
14
15# Set this to 1 to work around IIS 6 craziness
16my $iis6_mode = 0;
17
18
19# IIS 6: for some reason, IIS runs this script with the working
20# directory set to the Greenstone directory rather than the cgi-bin
21# directory, causing lots of stuff to fail
22if ($iis6_mode)
23{
24 # Change into cgi-bin\<OS> directory
25 chdir("cgi-bin");
26 if(defined $ENV{'GSDLARCH'}) {
27 chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
28 } else {
29 chdir($ENV{'GSDLOS'});
30 }
31}
32
33
34# We use require and an eval here (instead of "use") to catch any
35# errors loading the module (for IIS)
36eval('require "./gsdlCGI.pm"');
37if ($@)
38{
39 print STDOUT "Content-type:text/plain\n\n";
40 print STDOUT "ERROR: $@\n";
41 exit 0;
42}
43
44sub main
45{
46 my $gsdl_cgi = new gsdlCGI();
47
48 # Load the Greenstone modules that we need to use
49 $gsdl_cgi->setup_gsdl();
50
51 my $gsdlhome = $ENV{'GSDLHOME'};
52 $gsdl_cgi->checked_chdir($gsdlhome);
53
54 require cgiactions::indexaction;
55
56 $gsdl_cgi->parse_cgi_args();
57
58 # We don't want the gsdlCGI module to return errors and warnings in XML
59 $gsdl_cgi->{'xml'} = 0;
60
61 my $action = new indexaction($gsdl_cgi,$iis6_mode);
62
63 $action->do_action();
64}
65
66&main();
Note: See TracBrowser for help on using the repository browser.