I tried the following code submitted by Don, but got the following errors.
[Tue Apr 9 16:32:38 2002] nul: untie attempted while 1 inner references still exist at C:/apache/Apache/cgi-lib/FLOE/App/Btops.pm line 101. [Tue Apr 9 16:32:38 2002] nul: untie attempted while 1 inner references still exist at C:/apache/Apache/cgi-lib/FLOE/App/Btops.pm line 102. [Tue Apr 09 16:32:38 2002] [error] open3: Can't call method "close" on an undefined value at C:/Perl/lib/IPC/Open3.pm line 327. Per UNTIE docs, this occurs when a second reference exits for the tied object. I do not see where, though. Further assistance appreciated! Thanks, Ward P.S. I tried to use IPC::Run, but was unsuccessful. seems flakey on win2k. : -----Original Message----- : From: Don Hayward [mailto:[EMAIL PROTECTED]] : Sent: Thursday, April 04, 2002 6:28 AM : To: Vuillemot, Ward W : Subject: RE: Open3 : : : Hi Ward -- : : Since Perl5.6 someting like this has been necessary for : Open2 and Open3 : under modperl: : : : : my ($stdin, $stdout, $stderr); : $stdin = tied *STDIN; : $stdout = tied *STDOUT; : $stderr = tied *STDERR; : untie *STDIN; : untie *STDOUT; : untie *STDERR; : use FileHandle; : my $Reader = new FileHandle; : my $Writer = new FileHandle; : my $ERR = new Filehandle; : use IPC::Open3; : my $pid = open3( \*Writer,\*Reader, \*ERR, "somescript"); : unless ($pid) { print "open3 failed\n",$c->end_html; exit; } : Writer->autoflush(); : . : . : . : print Writer "$stuff\n"; : my $ret = <Reader>; : . : . : . : tie *STDIN, ref $stdin, $stdin; : tie *STDOUT, ref $stdout, $stdout; : tie *STDERR, ref $stderr, $stderr; : -------------------- : : On Wed, 3 Apr 2002, Vuillemot, Ward W wrote: : : > Since we are on the topic...and before some says it is : WOT, I wanted to ask : > a corollary question. : > : > I wrote a simple script to use Open2 as a means of : interacting with some : > FORTRAN programs I have. I wanted to create pre and : post-processing using : > PERL and leave the numerical stuff (and tons of legacy : code) to the FORTRAN. : > Anyway, the Perl script from a command prompt works -- it sends : > pre-processed data as STDIN and catches the processed : data from STDOUT : > without a hitch. The moment I try it running Apache : 1.33, Perl 5.6.1, : > latest version of Open2, and mod_perl the thing just : ties up all the : > computer's resources. : > : > If I could get it to work then I would be a LONG WAY to : really altering the : > way we do things at work. : > : > I have read what docs there are with Perl for this. . : .but I am wondering if : > there are any caveats that I should be aware from using : a web-server to : > initiate the commands. Or is there an alternative : method I might explore? : > : > thanks! : > Ward : > : > : -----Original Message----- : > : From: Rasoul Hajikhani [mailto:[EMAIL PROTECTED]] : > : Sent: Wednesday, April 03, 2002 1:54 PM : > : To: Elizabeth Mattijsen : > : Cc: [EMAIL PROTECTED] : > : Subject: Re: Open3 : > : : > : : > : Elizabeth Mattijsen wrote: : > : > : > : > At 01:44 PM 4/3/02 -0800, Rasoul Hajikhani 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: : > : > >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? : > : > : > : > Make sure your IPC::Open3 is up-to-date. If it is the : > : version that came : > : > with Perl 5.053, it probably has a bug in it. I : > : remember having to patch : > : > it waaay back (like 5 years ago) to get it to : work properly... : > : > : > : > Elizabeth Mattijsen : > : : > : My IPC::Open3 is OK. My problem is with IO::Select. Does : > : anyone know : > : whether IO::Select has any bugs? I have read the man : > : pages and looked : > : through the Perl Cook Book for a code snipet that would : > : use IO::Select : > : to write to STDIN. The one that is in the book does not : > : work for me. So : > : any comments/suggestions? : > : Thanks in advance : > : -r : > : : > : : Don Hayward [EMAIL PROTECTED] : Mote Marine Laboratory Voice: 941.388.4441 : Cell: 941.302.4982 : 1600 Ken Thompson Parkway Fax: 941.388.4312 : Sarasota, FL 34236 See: http://www.mote.org : Independent, non-profit, marine and estuarine research : and education facility. : For PGP public key do: http://www.mote.org/~don/donpgp.asc : use "DISCLAIMER"; # We run : Linux,Apache/mod_perl/mod_ssl/eperl,Mysql,DBI/DBD : Taxes feed the starving and clothe the naked. :