[23467] | 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
|
---|
[19293] | 6 |
|
---|
| 7 | use strict;
|
---|
| 8 |
|
---|
[23404] | 9 | BEGIN {
|
---|
| 10 | # Line to stop annoying child DOS CMD windows from appearing
|
---|
[23467] | 11 | Win32::SetChildShowWindow(0)
|
---|
| 12 | if defined &Win32::SetChildShowWindow;
|
---|
| 13 |
|
---|
[23404] | 14 | }
|
---|
[19293] | 15 |
|
---|
| 16 | # Set this to 1 to work around IIS 6 craziness
|
---|
| 17 | my $iis6_mode = 0;
|
---|
| 18 |
|
---|
| 19 |
|
---|
[23467] | 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
|
---|
[19293] | 23 | if ($iis6_mode)
|
---|
| 24 | {
|
---|
| 25 | # Change into cgi-bin directory
|
---|
| 26 | chdir("cgi-bin");
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 |
|
---|
[23467] | 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"');
|
---|
[19293] | 33 | if ($@)
|
---|
| 34 | {
|
---|
| 35 | print STDOUT "Content-type:text/plain\n\n";
|
---|
| 36 | print STDOUT "ERROR: $@\n";
|
---|
| 37 | exit 0;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 | sub 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();
|
---|
[23404] | 48 |
|
---|
[19293] | 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();
|
---|