source: main/trunk/greenstone2/cgi-bin/metadata-server.pl@ 24872

Last change on this file since 24872 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.7 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
16# Set this to 1 to work around IIS 6 craziness
17my $iis6_mode = 0;
18
19
20# IIS 6: for some reason, IIS runs this script with the working
21# directory set to the Greenstone directory rather than the cgi-bin
22# directory, causing lots of stuff to fail
23if ($iis6_mode)
24{
25 # Change into cgi-bin\<OS> directory
26 chdir("cgi-bin");
27 if(defined $ENV{'GSDLARCH'}) {
28 chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
29 } else {
30 chdir($ENV{'GSDLOS'});
31 }
32}
33
34
35# We use require and an eval here (instead of "use") to catch any
36# errors loading the module (for IIS)
37eval('require "./gsdlCGI.pm"');
38if ($@)
39{
40 print STDOUT "Content-type:text/plain\n\n";
41 print STDOUT "ERROR: $@\n";
42 exit 0;
43}
44
45
46sub main
47{
48 my $gsdl_cgi = new gsdlCGI();
49
50
51 # Load the Greenstone modules that we need to use
52 $gsdl_cgi->setup_gsdl();
53
54 my $gsdlhome = $ENV{'GSDLHOME'};
55 $gsdl_cgi->checked_chdir($gsdlhome);
56
57 require cgiactions::metadataaction;
58
59
60 # Useful debug statement for seeing what packages have been included
61#### printf("%-45s%-s\n",$_,$INC{$_}) foreach (sort keys %INC);
62
63
64 $gsdl_cgi->parse_cgi_args();
65
66 # We don't want the gsdlCGI module to return errors and warnings in XML
67 $gsdl_cgi->{'xml'} = 0;
68
69 my $action = new metadataaction($gsdl_cgi,$iis6_mode);
70
71 $action->do_action();
72
73
74}
75
76
77
78&main();
Note: See TracBrowser for help on using the repository browser.