[24074] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | ##!C:/Perl/bin/perl -w
|
---|
| 3 |
|
---|
| 4 | # If not explicitly associating .pl filename ending with Perl in the
|
---|
| 5 | # web server's configuration file, then need to specify the full path of
|
---|
| 6 | # Perl above
|
---|
| 7 |
|
---|
| 8 | use strict;
|
---|
| 9 |
|
---|
| 10 | BEGIN {
|
---|
| 11 | # Line to stop annoying child DOS CMD windows from appearing
|
---|
| 12 | Win32::SetChildShowWindow(0)
|
---|
| 13 | if defined &Win32::SetChildShowWindow;
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | # Set this to 1 to work around IIS 6 craziness
|
---|
| 17 | my $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
|
---|
| 23 | if ($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)
|
---|
| 32 | eval('require "./gsdlCGI.pm"');
|
---|
| 33 | if ($@)
|
---|
| 34 | {
|
---|
| 35 | print STDOUT "Content-type:text/plain\n\n";
|
---|
| 36 | print STDOUT "ERROR: $@\n";
|
---|
| 37 | exit 0;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | sub main
|
---|
| 41 | {
|
---|
| 42 | my $gsdl_cgi = new gsdlCGI();
|
---|
| 43 |
|
---|
| 44 | # Load the Greenstone modules that we need to use
|
---|
| 45 | $gsdl_cgi->setup_gsdl();
|
---|
| 46 |
|
---|
| 47 | my $gsdlhome = $ENV{'GSDLHOME'};
|
---|
| 48 | $gsdl_cgi->checked_chdir($gsdlhome);
|
---|
| 49 |
|
---|
| 50 | require cgiactions::buildaction;
|
---|
| 51 |
|
---|
| 52 | $gsdl_cgi->parse_cgi_args();
|
---|
| 53 |
|
---|
| 54 | # We don't want the gsdlCGI module to return errors and warnings in XML
|
---|
| 55 | $gsdl_cgi->{'xml'} = 0;
|
---|
| 56 |
|
---|
| 57 | my $action = new buildaction($gsdl_cgi,$iis6_mode);
|
---|
| 58 |
|
---|
| 59 | $action->do_action();
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | &main();
|
---|