source: main/trunk/greenstone2/cgi-bin/build-server.pl@ 23469

Last change on this file since 23469 was 23469, checked in by davidb, 13 years ago

Initial cut at code to support collection building thrugh AJAX calls to Perl CGI scripts

  • Property svn:executable set to *
File size: 1.4 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 directory
25 chdir("cgi-bin");
26}
27
28
29# We use require and an eval here (instead of "use") to catch any
30# errors loading the module (for IIS)
31eval('require "./gsdlCGI.pm"');
32if ($@)
33{
34 print STDOUT "Content-type:text/plain\n\n";
35 print STDOUT "ERROR: $@\n";
36 exit 0;
37}
38
39sub main
40{
41 my $gsdl_cgi = new gsdlCGI();
42
43 # Load the Greenstone modules that we need to use
44 $gsdl_cgi->setup_gsdl();
45
46 my $gsdlhome = $ENV{'GSDLHOME'};
47 $gsdl_cgi->checked_chdir($gsdlhome);
48
49 require cgiactions::buildaction;
50
51 $gsdl_cgi->parse_cgi_args();
52
53 # We don't want the gsdlCGI module to return errors and warnings in XML
54 $gsdl_cgi->{'xml'} = 0;
55
56 my $action = new buildaction($gsdl_cgi,$iis6_mode);
57
58 $action->do_action();
59}
60
61&main();
Note: See TracBrowser for help on using the repository browser.