I'm having some problems getting open2 to work and I was wondering if someone
could help me out.
Basically, I'm spawning FTP in a process. I am writing a test script to test
an FTP server that my company wrote. The FTP server has to resume aborted
downloads. So the reason why I'm spawning the FTP application rather than
using the Net::FTP module is because I have to kill the FTP transfer in the
middle and I don't think that's possible with Net::FTP. So the reason why I
need to use open2 is because I need to send and receive data to an external
app, and regular open is not capable of that.
So here's my code right now:
use IPC::Open2 ;
$ftpPid = open2( *FTPREAD, *FTPWRITE, '/usr/bin/ftp' ) ;
# Here I'm trying to open the FTP session
print FTPWRITE ( 'open 10.0.0.2' ) ;
# Here I'm waiting for the command to be acknowledged so I can continue with
while( defined( $line = <FTPREAD> ) )
chomp( $line ) ;
# This line wait for the Name regexp
if( $line =~ m/Name/ )
...and so it hangs in these various while loops I have because there is
apparently no data on the FTPREAD filehandle.
Is there something else I need to or something? I have also tried opening
the filehandles with \'s (i.e. \*FTPWRITE, \*FTPREAD ), but that doesn't seem
to work either.
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.