root/main/trunk/greenstone2/cgi-bin/metadata-server.pl @ 23404

Revision 23404, 1.4 KB (checked in by max, 10 years ago)

Magic one liner that stops the flash DOS CMD window problem!

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