IPC::Open3
Hi there, I am having trouble making open3 work with perl, v5.6.1 built for i386-linux. I am running Apache/1.3.27 Ben-SSL/1.48 (Unix) PHP/4.2.3 mod_perl/1.27. My problem is that I can't write to STDIN. Does any one know of any solution to this problem? Has any one encountered the same issue? Any suggestions and help is greatly appreciated. -r
Re: IPC::Open3
Rasoul Hajikhani wrote: Hi there, I am having trouble making open3 work with perl, v5.6.1 built for i386-linux. I am running Apache/1.3.27 Ben-SSL/1.48 (Unix) PHP/4.2.3 mod_perl/1.27. My problem is that I can't write to STDIN. Does any one know of any solution to this problem? Has any one encountered the same issue? Any suggestions and help is greatly appreciated. It's a known problem. The solution: s/IPC::Open3/IPC::Run/ Barries has also written IPC::Run3, which should act as a drop-in replacement for IPC::Open3, if you have to stick with the same API. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
IPC::Open3 Corrected code version
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
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
Re: [Slightly OT] IPC::Open3 broken in mod_perl/perl 5.6.0?
On Mon, 17 Apr 2000, Richard Titmuss wrote: Hi, I have also had this problem. I checked the modperl-cvs archive and this problem has been fixed in the development release. yes, the cvs version implements Apache::OPEN I still have an problem using IPC::Open2. This can be demonstrated by: use IPC::Open2; $pid = open2(\*A, \*B, '/usr/bin/ls'); The error log shows: [error] Can't locate object method "FILENO" via package "Apache" at /usr/local/lib/perl5/5.6.0/IPC/Open3.pm line 183. does this fix it: sub Apache::FILENO { untie *STDOUT; fileno STDOUT; } ?
Re: [Slightly OT] IPC::Open3 broken in mod_perl/perl 5.6.0?
Hi, I have also had this problem. I checked the modperl-cvs archive and this problem has been fixed in the development release. I still have an problem using IPC::Open2. This can be demonstrated by: use IPC::Open2; $pid = open2(\*A, \*B, '/usr/bin/ls'); The error log shows: [error] Can't locate object method "FILENO" via package "Apache" at /usr/local/lib/perl5/5.6.0/IPC/Open3.pm line 183. I do not understand enough about the perl/mod-perl guts to produce a patch. Any help appreciated. Thanks, Richard -- Richard Titmuss Email: [EMAIL PROTECTED] B55 Rm122, BT Laboratories Martlesham HeathTel: +44 (0)1473 640306 Ipswich, Suffolk, IP5 3RE, UK Fax: +44 (0)1473 646885
[Slightly OT] IPC::Open3 broken in mod_perl/perl 5.6.0?
Sorry if this is slightly off topic. I seem to have run into problems using IPC::Open3 under mod_perl 1.22 and perl 5.6.0. This probelm only seems to have cropped up after I upgraded form perl 5.005 to perl 5.6.0. What happens is I have an exception handler that opens gpg and uses gpg to encrypt some data and email it to me in the case of an exception. The code looks like this: my $input = new IO::Handle; my $output = new IO::Handle; my $error = new IO::Handle; my $cmd = "gpg --homedir /etc/httpd/perl/gkgnsi/gpg -r $to -ea"; my $pid = IPC::Open3::open3($input, $output, $error, $cmd); THis worked fine when I was running perl 5.005, but now it dies here, and the apache error_log shows: [error] Can't locate object method "OPEN" via package "Apache" at /usr/lib/perl5/5.6.0/IPC/Open3.pm line 132. Strange... Has anyone seen anything like this? Anyone have any ideas? Thanks. Mike