Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > synchronus ftp call

Reply
Thread Tools

synchronus ftp call

 
 
chris
Guest
Posts: n/a
 
      11-06-2004
I have the following bit of code that makes a call to the ftp binary.
The call seems to be happening asynchronusly. How can I make perl
wait for the print FTP statement to finish?

Is there a better way of doing this (e.g. system() call, etc.,)? My
perl version is 5.005_02 built for PA-RISC1.1. I am not able to use
any perl libs such as Net::Ftp.

#################################

open FTP, "|$FTP -n" or die $!;

print FTP <<EndFTP
open $FTP_SITE
user $FTP_USER
pass $FTP_PASS
get README
quit
EndFTP

#################################

Thanks in advance,

Chris
 
Reply With Quote
 
 
 
 
Brian McCauley
Guest
Posts: n/a
 
      11-06-2004


chris wrote:

> Subject: synchronus ftp call


> I am not able to use any perl libs such as Net::Ftp.


You are not partitioning your question correctly. You've concuded that
you are not able to use Net::FTP but need to use a subprocess. As such
the Perl part of your question is only about handling subprocesses an
not about FTP.

> I have the following bit of code that makes a call to the ftp binary.
> The call seems to be happening asynchronusly.


> open FTP, "|$FTP -n" or die $!;
>
> print FTP <<EndFTP
> open $FTP_SITE
> user $FTP_USER
> pass $FTP_PASS
> get README
> quit
> EndFTP


When you issue a close(FTP) perl will wait for the subrocess to complete.

> How can I make perl wait for the print FTP statement to finish?


It is not the print statement you want to wait for, it is the subrocess.

> Is there a better way of doing this (e.g. system() call, etc.,)?


You can put the ftp session input into a temporary file then use
system(). This, of course, has little to do with Perl - it would apply
equally in most languages.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sun.net.ftp.FtpProtocolException: Error reading FTP pending reply long990802@gmail.com Java 3 12-11-2005 02:46 AM
Re: ftplib question - ftp.dir() returns something and ftp.nlst()does not Nico Grubert Python 0 11-25-2005 10:09 AM
ftplib question - ftp.dir() returns something and ftp.nlst() does not Nico Grubert Python 0 11-24-2005 02:00 PM
Net::FTP problems getting files from Windows FTP server, but not Linux FTP Server. D. Buck Perl Misc 2 06-29-2004 02:05 PM
FTP over SSL vs FTP over SSH someone Java 1 04-25-2004 03:30 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57