Y
yzhshi
hello, the follow code get different result from Command line and
browser
that is to say ,i get the correct result from the command line,but i
cant say the result from browser.
IPC::RUN is used in this code; i get it from
http://ppm.activestate.com/PPMPackages/zips/8xx-builds-only/Windows/IPC-Run-0.77.zip
my environment is:
Microsoft windows 2000 professional
Apache 2.0.49
Active Perl 5.8.3.809
because i am new to perl,i can not solve this.
Please help!thanks a lot.
---------------------------------------------------------------------------
#!C:\perl\bin\perl.exe -w
use strict;
use IPC::Run qw(start finish) ;
use CGI::Carp qw(fatalsToBrowser);
print "Content-type: text/html\n\n";
my @cmd = qw(C:\winnt\system32\ping.exe) ;
push(@cmd,'www.google.com');
push(@cmd,'-n');
push(@cmd,'1');
my $h ;
local(*OUT,*ERR);
#this line cannot be modified
$h = start (\@cmd,\"" ,'>pipe', \*OUT, '2>pipe', \*ERR)|| die("can't
write some_file: $!");
print "Result!\n";
print "the out is:\n";print <OUT>;
print "the result is err\n"; print <ERR>;
close(OUT);
close(ERR);
finish $h ;
---------------------------------------------------------------------------
browser
that is to say ,i get the correct result from the command line,but i
cant say the result from browser.
IPC::RUN is used in this code; i get it from
http://ppm.activestate.com/PPMPackages/zips/8xx-builds-only/Windows/IPC-Run-0.77.zip
my environment is:
Microsoft windows 2000 professional
Apache 2.0.49
Active Perl 5.8.3.809
because i am new to perl,i can not solve this.
Please help!thanks a lot.
---------------------------------------------------------------------------
#!C:\perl\bin\perl.exe -w
use strict;
use IPC::Run qw(start finish) ;
use CGI::Carp qw(fatalsToBrowser);
print "Content-type: text/html\n\n";
my @cmd = qw(C:\winnt\system32\ping.exe) ;
push(@cmd,'www.google.com');
push(@cmd,'-n');
push(@cmd,'1');
my $h ;
local(*OUT,*ERR);
#this line cannot be modified
$h = start (\@cmd,\"" ,'>pipe', \*OUT, '2>pipe', \*ERR)|| die("can't
write some_file: $!");
print "Result!\n";
print "the out is:\n";print <OUT>;
print "the result is err\n"; print <ERR>;
close(OUT);
close(ERR);
finish $h ;
---------------------------------------------------------------------------