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\<OS> directory
|
---|
25 | chdir("cgi-bin");
|
---|
26 | if(defined $ENV{'GSDLARCH'}) {
|
---|
27 | chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
|
---|
28 | } else {
|
---|
29 | chdir($ENV{'GSDLOS'});
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 |
|
---|
34 | # We use require and an eval here (instead of "use") to catch any
|
---|
35 | # errors loading the module (for IIS)
|
---|
36 | eval('require "./gsdlCGI.pm"');
|
---|
37 | if ($@)
|
---|
38 | {
|
---|
39 | print STDOUT "Content-type:text/plain\n\n";
|
---|
40 | print STDOUT "ERROR: $@\n";
|
---|
41 | exit 0;
|
---|
42 | }
|
---|
43 |
|
---|
44 | sub main
|
---|
45 | {
|
---|
46 | my $gsdl_cgi = new gsdlCGI();
|
---|
47 |
|
---|
48 | # Load the Greenstone modules that we need to use
|
---|
49 | $gsdl_cgi->setup_gsdl();
|
---|
50 |
|
---|
51 | my $gsdlhome = $ENV{'GSDLHOME'};
|
---|
52 | $gsdl_cgi->checked_chdir($gsdlhome);
|
---|
53 |
|
---|
54 | require cgiactions::explodeaction;
|
---|
55 |
|
---|
56 | $gsdl_cgi->parse_cgi_args();
|
---|
57 |
|
---|
58 | # We don't want the gsdlCGI module to return errors and warnings in XML
|
---|
59 | $gsdl_cgi->{'xml'} = 0;
|
---|
60 |
|
---|
61 | my $action = new explodeaction($gsdl_cgi,$iis6_mode);
|
---|
62 |
|
---|
63 | $action->do_action();
|
---|
64 | }
|
---|
65 |
|
---|
66 | &main();
|
---|