- Timestamp:
- 2017-03-13T19:48:56+13:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/servercontrol.pm
r31488 r31507 140 140 141 141 my $wget_file_path = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "wget"); 142 142 my $tmpfilename = time . ".html"; # random name for file wherein we'll store the HTML page retrieved by wget 143 143 144 # https://www.gnu.org/software/wget/manual/wget.html 144 145 # output-document set to - (STDOUT), so page is streamed to STDOUT … … 147 148 # Searching for "perl backtick operator redirect stderr to stdout": 148 149 # http://www.perlmonks.org/?node=How%20can%20I%20capture%20STDERR%20from%20an%20external%20command%3F 149 $wgetCommand = "\"$wget_file_path\" --output-document=- -T 5 -t 1 \"$library_url$wgetCommand\" 2>&1"; 150 #$wgetCommand = "\"$wget_file_path\" --spider -T 5 -t 1 \"$library_url$wgetCommand\" 2>&1"; # won't save page 150 ##$wgetCommand = "\"$wget_file_path\" --spider -T 5 -t 1 \"$library_url$wgetCommand\" 2>&1"; # won't save page 151 #$wgetCommand = "\"$wget_file_path\" --output-document=- -T 5 -t 1 \"$library_url$wgetCommand\" 2>&1"; # THIS CAN MIX UP STDERR WITH STDOUT IN THE VERY LINE WE REGEX TEST AGAINST EXPECTED OUTPUT!! 152 $wgetCommand = "\"$wget_file_path\" --output-document=$tmpfilename -T 5 -t 1 \"$library_url$wgetCommand\" 2>&1"; # keep stderr (response code, response_content) separate from html page content 153 151 154 ##print STDERR "@@@@ $wgetCommand\n"; 152 155 … … 185 188 186 189 # check the page content is as expected 187 my $resultstr = $response_content; 190 #my $resultstr = $response_content; 191 192 open(FIN,"<$tmpfilename") or die "servercontrol.pm: Unable to open $tmpfilename to read ping response page...ERROR: $!\n"; 193 my $resultstr; 194 # Read in the entire contents of the file in one hit 195 sysread(FIN, $resultstr, -s FIN); 196 close(FIN); 197 &FileUtils::removeFiles("$tmpfilename"); 198 188 199 #$resultstr =~ s@.*gs_content\"\>@@s; ## only true for default library servlet 189 200 #$resultstr =~ s@</div>.*@@s;
Note:
See TracChangeset
for help on using the changeset viewer.