Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ensuring FTP calls complete

Reply
Thread Tools

Ensuring FTP calls complete

 
 
James Reynolds
Guest
Posts: n/a
 
      04-12-2008
I'm a mid level java guy trying out Ruby. I'm rewriting a java ftp app
in Ruby to learn about this aspect of language. One thing I've been
wondering is how Ruby handles problems encountered with ftp. For
example, in Java (using the commons.net.ftp lib) I'm constantly
checking to ensure my ftp calls actually work. When logging in, I check
to make sure that the reply code indicates a successful login.
Afterwards, I rely on the boolean return values provided by the methods
in the library to know if I actually downloaded/uploaded a file, etc.

In the Ruby docs, the return_code function is listed as "Obsolete." In
the examples I've studied, I haven't seen the kind of checking I'm
accustomed to writing. I realize that - examples being what they are -
the focus is on brevity and functionality, and "boiler plate" code may
be omitted.

What are the best practices in this case?

Thanks
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Arlen Cuss
Guest
Posts: n/a
 
      04-13-2008
[Note: parts of this message were removed to make it a legal post.]

Hi,

On Sun, Apr 13, 2008 at 3:32 AM, James Reynolds <(E-Mail Removed)>
wrote:

> In the Ruby docs, the return_code function is listed as "Obsolete."



It's not only obsolete; quick squiz at the code reveals it does nothing:

def return_code
$stderr.puts("warning: Net::FTP#return_code is obsolete and do
nothing")
return "\n"
end

The short answer is, net/ftp will (probably) throw an exception if something
goes wrong. Try reading the code yourself, depending on what you do. I don't
have experience with it, but hopefully a guru here does.
(on my system [Ubuntu], I can find net/ftp's code at
/usr/lib/ruby/1.8/net/ftp.rb)

Cheers,
Arlen.

 
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
Ensuring directory deletion has complete Mark Java 1 12-08-2005 02:05 PM
Ensuring Security at HotSpots question Bill Wireless Networking 7 11-03-2004 11:29 AM
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
Ensuring a listbox has at least one value in it Simon ASP .Net 3 05-26-2004 02:18 PM
ensuring that all declared controls have been drawn David ASP .Net 0 05-02-2004 09:46 AM



Advertisments