From: Minero Aoki Date: 2001-04-26T01:45:00+09:00 Subject: [ruby-list:29411] Re: net/pop 1.2.0 あおきです。 報告ありがとうございます。 In mail "[ruby-list:29407] net/pop 1.2.0" matsue wrote: > 松江です。 > その後、付属のサンプルスクリプト popmail.rb を試してみたところ、 > サーバにメールがある時はいいのですがサーバにメールがないとき、 > そのまま固まってしまう現象が現れました。 > これは正常動作でしょうか? いえ、変です。なんですが、手元の環境では 1.6.2/1.6.3/1.7 で 再現しませんでした。とりあえず添付するスクリプトを $ ruby popmail.rb -p PASSWORD 2> out のように実行して、ファイル out を見せてもらえませんか? ------------------------------------------------------------------- 青木峰郎 require 'net/pop' require 'parsearg' def usage( stat = 1 ) print < [-u ] [] MSG exit stat end $USAGE = 'usage' parseArgs( 0, 'p', 'h', 'p:', 'u:', 'help' ) if $OPT_h or $OPT_help then usage 0 end host = ARGV[0] || 'localhost' account = $OPT_u || ENV['USER'] password = $OPT_p class F def initialize( f ) @f = f end def <<( str ) @f.write str.sub(/PASS [^\\]+/, 'PASS ********') @f.flush self end end pop = Net::POP.new( host, 110 ) pop.set_debug_output F.new($stderr) pop.start( account, password ) do |pop| if pop.mails.empty? then $stderr.puts 'ok' else # ignore $stderr.puts 'mail exist. try with empty mailbox.' end end