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 |
|
---|
7 | use strict;
|
---|
8 |
|
---|
9 | BEGIN {
|
---|
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
|
---|
16 | my $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
|
---|
22 | if ($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)
|
---|
31 | eval('require "./gsdlCGI.pm"');
|
---|
32 | if ($@)
|
---|
33 | {
|
---|
34 | print STDOUT "Content-type:text/plain\n\n";
|
---|
35 | print STDOUT "ERROR: $@\n";
|
---|
36 | exit 0;
|
---|
37 | }
|
---|
38 |
|
---|
39 | sub 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();
|
---|