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