[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

net/ftp issue

elbart0

10/31/2004 9:19:00 AM

Hi,

I am having problem with the 'net/ftp' library (ruby 1.8.2 (2004-08-24)
[i386-linux]).
If I make a simple call to FTP#mtime method, the following error occurs:

/usr/lib/ruby/1.8/net/ftp.rb:700:in `mtime': private method `scan' called for
nil:NilClass (NoMethodError)

which means that FTP#mdtm method returns nil.
In fact, only the very first call to FTP#mdtm returns nil!

The following script should reproduce the error :

require 'net/ftp'

$, = ' '
$\ = "\n"

Net::FTP.open('ftp.ruby-lang.org') do |ftp|
ftp.login
ftp.chdir('pub/ruby/stable')
ftp.list('*') do |line|
# p line
if line =~ /^[-d]/
fileName = line.split[-1]
isFile = line[0] == ?-
print 'entry:', fileName, isFile ? 'is a file' : 'is a directory'
if isFile
# print 'mdtm:', ftp.mdtm(fileName) # <-- if commented, fails
print 'mtime:', ftp.mtime(fileName)
end
end
end
end

I guess it's not related to 'net/ftp' library!
But could you confirm?

Best Regards,
Bart.


2 Answers

ts

10/31/2004 11:07:00 AM

0

>>>>> "e" == elbart0 <elbart0@free.fr> writes:


Try it with

e> Net::FTP.open('ftp.ruby-lang.org') do |ftp|
e> ftp.login
e> ftp.chdir('pub/ruby/stable')
e> ftp.list('*') do |line|

ftp.list('*').each do |line|

e> # p line
e> if line =~ /^[-d]/



Guy Decoux



elbart0

10/31/2004 5:06:00 PM

0

Shame on me!
And thank you for replying.

Quoting ts <decoux@moulon.inra.fr>:

> >>>>> "e" == elbart0 <elbart0@free.fr> writes:
>
>
> Try it with
>
> e> Net::FTP.open('ftp.ruby-lang.org') do |ftp|
> e> ftp.login
> e> ftp.chdir('pub/ruby/stable')
> e> ftp.list('*') do |line|
>
> ftp.list('*').each do |line|
>
> e> # p line
> e> if line =~ /^[-d]/
>
>
>
> Guy Decoux
>
>
>