Skip to main content.
home | support | download

Back to List Archive

backticks vs. fork/exec (was RE: nt port of JSWISHI)

From: SRE <eckert(at)not-real.climber.org>
Date: Thu Mar 16 2000 - 00:07:57 GMT
At 09:17 AM 3/14/00 -0330, Coates, David XWAVE wrote: 
>>>>
It appears that the following code does not execute under Windows NT 4.0 Using active perl 
sub capture_stdout  
[snip[
<<<<

Here are the comments in my version of the JSWISHI script,
not sure which version you are using, but it appears these
comments have been deleted from yours while other comments
were left in...

In the code fragment below, note the "OLD METHOD" comment,
and use that line instead of the rest of the routine. Be
forewarned, however, that backticks can cause damage to
your system if someone manages to construct a malicious
sequence of search words. That's why it's the OLD method!

-------------------------------------------

# The capture_stdout subroutine is used because backticks let shell metacharacters evaluate
# program to exec should be in first arg, remaining args are array of command line args
# NOTE: Can use backticks, open/exec, or spawn... first and last methods are commented out below!
#       (only backticks seem to work on WinNT, but are unsafe for CGI applications)

sub capture_stdout {

    my $sleep_count = 0;
    my $output = "";
    my $stroke = "";

    #OLD METHOD# $output = `@_`;
Received on Wed Mar 15 19:08:33 2000