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

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

Tidy up of comments line-wrap, and more specific include of gsdlCGI.pm file

  • 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
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 directory
26 chdir("cgi-bin");
27}
28
29
30# We use require and an eval here (instead of "use") to catch any
31# errors loading the module (for IIS)
32eval('require "./gsdlCGI.pm"');
33if ($@)
34{
35 print STDOUT "Content-type:text/plain\n\n";
36 print STDOUT "ERROR: $@\n";
37 exit 0;
38}
39
40
41sub main
42{
43 my $gsdl_cgi = new gsdlCGI();
44
45
46 # Load the Greenstone modules that we need to use
47 $gsdl_cgi->setup_gsdl();
48
49 my $gsdlhome = $ENV{'GSDLHOME'};
50 $gsdl_cgi->checked_chdir($gsdlhome);
51
52 require cgiactions::metadataaction;
53
54
55 # Useful debug statement for seeing what packages have been included
56#### printf("%-45s%-s\n",$_,$INC{$_}) foreach (sort keys %INC);
57
58
59 $gsdl_cgi->parse_cgi_args();
60
61 # We don't want the gsdlCGI module to return errors and warnings in XML
62 $gsdl_cgi->{'xml'} = 0;
63
64 my $action = new metadataaction($gsdl_cgi,$iis6_mode);
65
66 $action->do_action();
67
68
69}
70
71
72
73&main();
Note: See TracBrowser for help on using the repository browser.