source: main/trunk/greenstone2/cgi-bin/experimental-ocr-server.pl@ 23765

Last change on this file since 23765 was 23765, checked in by davidb, 13 years ago

First cut at a server that runs a command-line OCR application (Tesseract). Currently only tested on Windows, 64-bit

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!C:\Perl\bin\perl -w
2
3##!/usr/bin/perl -w
4##!C:\\Perl\\bin\\perl -w
5
6# If not explicitly associating .pl filename ending with Perl in the
7# web server's configuration file, then need to specify the full path of
8# Perl above
9
10use strict;
11
12BEGIN {
13 # Line to stop annoying child DOS CMD windows from appearing
14 Win32::SetChildShowWindow(0)
15 if defined &Win32::SetChildShowWindow;
16
17}
18
19# Set this to 1 to work around IIS 6 craziness
20my $iis6_mode = 0;
21
22
23# IIS 6: for some reason, IIS runs this script with the working
24# directory set to the Greenstone directory rather than the cgi-bin
25# directory, causing lots of stuff to fail
26if ($iis6_mode)
27{
28 # Change into cgi-bin directory
29 chdir("cgi-bin");
30}
31
32
33# We use require and an eval here (instead of "use") to catch any
34# errors loading the module (for IIS)
35eval('require "./gsdlCGI.pm"');
36if ($@)
37{
38 print STDOUT "Content-type:text/plain\n\n";
39 print STDOUT "ERROR: $@\n";
40 exit 0;
41}
42
43sub main
44{
45 my $gsdl_cgi = new gsdlCGI();
46 $gsdl_cgi->setup_gsdl();
47
48 my $gsdlhome = $ENV{'GSDLHOME'};
49 $gsdl_cgi->checked_chdir($gsdlhome);
50
51 require cgiactions::ocraction;
52
53 $gsdl_cgi->parse_cgi_args();
54 $gsdl_cgi->{'xml'} = 0;
55
56 my $action = new ocraction($gsdl_cgi,$iis6_mode);
57 $action->do_action();
58}
59
60&main();
Note: See TracBrowser for help on using the repository browser.