source: main/trunk/greenstone2/common-src/cgi-bin/document-extract.pl@ 31960

Last change on this file since 31960 was 28242, checked in by davidb, 11 years ago

New CGI program to manipulate doc.xml files to remove some sections/pages from it, and move those pages/sectionss into a separate document

  • Property svn:executable set to *
File size: 1.8 KB
Line 
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
7use strict;
8
9BEGIN {
10 # Line to stop annoying child DOS CMD windows from appearing
11 Win32::SetChildShowWindow(0)
12 if defined &Win32::SetChildShowWindow;
13
14}
15
16# Set this to 1 to work around IIS 6 craziness
17my $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
23if ($iis6_mode)
24{
25 # Change into cgi-bin\<OS> directory
26 chdir("cgi-bin");
27 if(defined $ENV{'GSDLARCH'}) {
28 chdir($ENV{'GSDLOS'}.$ENV{'GSDLARCH'});
29 } else {
30 chdir($ENV{'GSDLOS'});
31 }
32}
33
34
35# We use require and an eval here (instead of "use") to catch any
36# errors loading the module (for IIS)
37eval('require "./gsdlCGI.pm"');
38if ($@)
39{
40 print STDOUT "Content-type:text/plain\n\n";
41 print STDOUT "ERROR: $@\n";
42 exit 0;
43}
44
45
46sub main
47{
48 my $gsdl_cgi = new gsdlCGI();
49
50
51 # Load the Greenstone modules that we need to use
52 $gsdl_cgi->setup_gsdl();
53
54 my $gsdlhome = $ENV{'GSDLHOME'};
55 $gsdl_cgi->checked_chdir($gsdlhome);
56
57 # Encrypt the password and key
58 $gsdl_cgi->encrypt_password();
59 $gsdl_cgi->encrypt_key();
60
61 require cgiactions::docextractaction;
62
63
64 # Useful debug statement for seeing what packages have been included
65#### printf("%-45s%-s\n",$_,$INC{$_}) foreach (sort keys %INC);
66
67
68 $gsdl_cgi->parse_cgi_args();
69
70 # We don't want the gsdlCGI module to return errors and warnings in XML
71 $gsdl_cgi->{'xml'} = 0;
72
73 my $action = new docextractaction($gsdl_cgi,$iis6_mode);
74
75 $action->do_action();
76
77
78}
79
80
81
82&main();
Note: See TracBrowser for help on using the repository browser.