source: main/trunk/greenstone2/cgi-bin/image-server.pl@ 21377

Last change on this file since 21377 was 19293, checked in by davidb, 15 years ago

Introduction of Perl-based CGI 'actions' plus supporting modules

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