IPC::Open3 Corrected code version

2002-04-03 Thread Rasoul Hajikhani

Hello folks,
I am writing a web based interface to gpg and am using IPC::Open3 and
IO::Select to manage STDIN, STDOUT and STDERR handles. But, I can not
get stdin to work properly. Here is my code:

$gpgCommand = gpg --homedir $home --no-default-keyring
--secret-keyring rasoul.asc --decrypt $encryptedFile;
print $gpgCommand\n;
$pid= open3(*FIN,*FOUT,*FERR,$gpgCommand);
$SIG{CHLD}  = sub { print REAPER: status $? on $pid\n if
waitpid($pid,0)  0 };


$selector   = IO::Select-new();
$selector-add(*FIN,*FOUT,*FERR);
while (handles = $selector-handles)
{   
foreach my $fh (handles)
{   
if (fileno($fh) == fileno(FERR))
{   
print STDERR: , scalar FERR
}
elsif (fileno($fh) == fileno(FOUT))
{   
out= FOUT;
}
elsif ((fileno($fh) == fileno(FIN))
{
print FIN $passPhrase\n;
}
$selector-remove($fh) if eof($fh);
}
}
$pf-close;
close FERR;
close FIN;  
close FOUT;

I am using perl 5.053 and Apache/1.3.14 Ben-SSL/1.42 (Unix) PHP/4.0.3pl1
mod_perl/1.24_01.
Can anyone see what am I doing wrong?
Thanks in advance
-r



Re: IPC::Open3 Corrected code version

2002-04-03 Thread Sreeji K Das

This is a known issue with latest mod_perl. Search the
archives for details.

This is the temp. solution. Before you call open3()
do:
untie(*STDIN);
untie(*STDOUT);

Sreeji
 --- Rasoul Hajikhani [EMAIL PROTECTED] wrote: 
Hello folks,
 I am writing a web based interface to gpg and am
 using IPC::Open3 and
 IO::Select to manage STDIN, STDOUT and STDERR
 handles. But, I can not
 get stdin to work properly. Here is my code:
 
 $gpgCommand = gpg --homedir $home
 --no-default-keyring
 --secret-keyring rasoul.asc --decrypt
 $encryptedFile;
 print $gpgCommand\n;
 $pid=
 open3(*FIN,*FOUT,*FERR,$gpgCommand);
 $SIG{CHLD}  = sub { print REAPER: status $? on
 $pid\n if
 waitpid($pid,0)  0 };
 
 
 $selector   = IO::Select-new();
 $selector-add(*FIN,*FOUT,*FERR);
 while (@handles = $selector-handles)
 {   
 foreach my $fh (@handles)
 {   
 if (fileno($fh) == fileno(FERR))
 {   
 print STDERR: , scalar
 FERR
 }
 elsif (fileno($fh) == fileno(FOUT))
 {   
 @out= FOUT;
 }
 elsif ((fileno($fh) == fileno(FIN))
 {
 print FIN $passPhrase\n;
 }
 $selector-remove($fh) if eof($fh);
 }
 }
 $pf-close;
 close FERR;
 close FIN;  
 close FOUT;
 
 I am using perl 5.053 and Apache/1.3.14 Ben-SSL/1.42
 (Unix) PHP/4.0.3pl1
 mod_perl/1.24_01.
 Can anyone see what am I doing wrong?
 Thanks in advance
 -r 

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com