Net/pop error in Ruby 1.9


#1

e$B=uED$G$9!#e(B
Net::POP3.start e$B$Ge(B NoMethodError e$B$,$G$^$9!#e(B

$ cat x.rb
require ‘net/pop’
pwd = ‘XXXXX’
Net::POP3.start( ‘SERVER’, 110, ‘USER’, pwd ) do |ses|
end

$ ruby19 x.rb
/usr/local/lib/ruby/1.9/net/protocol.rb:66:in closed?': \ undefined methodclosed?’ for true:TrueClass (NoMethodError)
from /usr/local/lib/ruby/1.9/net/pop.rb:575:in do_finish' from /usr/local/lib/ruby/1.9/net/pop.rb:510:inensure in start’
from /usr/local/lib/ruby/1.9/net/pop.rb:510:in start' from /usr/local/lib/ruby/1.9/net/pop.rb:382:instart’
from x.rb:3:in `’

$ ruby19 -v
ruby 1.9.0 (2007-01-10 patchlevel 0) [i686-linux]

e$B=uED2m5*e(B


#2

e$B@DLZ$G$9!#e(B

In mail “[ruby-dev:30126] net/pop error in Ruby 1.9”
Masaki S. removed_email_address@domain.invalid wrote:

e$B=uED$G$9!#e(B
Net::POP3.start e$B$Ge(B NoMethodError e$B$,$G$^$9!#e(B

$ ruby19 x.rb
/usr/local/lib/ruby/1.9/net/protocol.rb:66:in closed?': \ undefined methodclosed?’ for true:TrueClass (NoMethodError)

e$B$?$V$se(B YARV e$B$,%^!<%8$5$l$?$H$-$@$H;W$$$^$9$,!“e(Blib/timeout.rb
e$B$,e(B
e$BJQ99$5$l$F$$$F!”$=$l$,e(B net/pop.rb e$B$KGH5Z$7$F$^$7$?!#e(BYARV
e$BA0$@$He(B
lib/timeout e$B$N%3!<%I$Oe(B

def timeout(sec, exception=Error)
return yield if sec == nil or sec.zero?
raise ThreadError, “timeout within critical session” if
Thread.critical
begin
x = Thread.current
y = Thread.start {
sleep sec
x.raise exception, “execution expired” if x.alive?
}
yield sec
# return true

e$B$H$J$C$F$Fe(B yield sec e$B$,JV$k$s$G$9$,!"e(BYARV
e$B8e$O%3%a%s%H$,2r=|$5$l$Fe(B
e$B$$$k$N$Ge(B true e$B$,JV$j$^$9!#e(B

e$B$I$C$A$,@5$7$$$s$G$7$g$&!#e(B

1 e$B9TL$H$N@09g@-$r9M$($k$H!"e(Byield e$B$N7k2L$,JV$C$F$-$?$[$&$,e(B

e$B$$$$$H;W$&$1$I!"%I%-%e%a%s%H$Oe(B true e$B$rJV$9$H8@$C$F$k$J$"e(B


#3

e$B!!$5$5$@$G$9!#e(B

Minero A. wrote:

    sleep sec

1 e$B9TL$H$N@09g@-$r9M$($k$H!"e(Byield e$B$N7k2L$,JV$C$F$-$?$[$&$,e(B

e$B$$$$$H;W$&$1$I!"%I%-%e%a%s%H$Oe(B true e$B$rJV$9$H8@$C$F$k$J$"e(B

e$B!!$J$s$GJQ$($?$N$+$5$C$Q$j3P$($F$$$J$$$N$G$9$,!"$H$j$"$($:e(B YARV
e$B$G$O$I$Ae(B
e$B$i$bF0$/$H;W$$$^$9$N$G!VNI$$;EMM!W$K$7$F$$$?$@$1$l$P$H;W$$$^$9!#e(B


#4

e$B$J$+$@$G$9!#e(B

At Fri, 19 Jan 2007 11:49:54 +0900,
Minero A. wrote in [ruby-dev:30148]:

e$B$?$V$se(B YARV e$B$,%^!<%8$5$l$?$H$-$@$H;W$$$^$9$,!“e(Blib/timeout.rb e$B$,e(B
e$BJQ99$5$l$F$$$F!”$=$l$,e(B net/pop.rb e$B$KGH5Z$7$F$^$7$?!#e(BYARV e$BA0$@$He(B

Thread.exclusivee$B$r<h$j=|$$$?$H$-$N%_%9$G$7$g$&$+!#e(B1.16->1.7e$B$NJQ99$b>C$($F$^$9$M!#e(B
e$B$$$:$l$K$;$h!“8E$$%P!<%8%g%s$r85$K$7$F$$$F!”$=$l$,$=$N$^$^F~$C$F$7$^$C$F$$$k$b$N$,B>$K$b$J$$$+!"%A%’%C%/$,I,MW$+$bCN$l$^$;$s!#e(B

lib/timeout e$B$N%3!<%I$Oe(B
(snip)
e$B$H$J$C$F$Fe(B yield sec e$B$,JV$k$s$G$9$,!"e(BYARV e$B8e$O%3%a%s%H$,2r=|$5$l$Fe(B
e$B$$$k$N$Ge(B true e$B$,JV$j$^$9!#e(B

e$B$I$C$A$,@5$7$$$s$G$7$g$&!#e(B

e$B%3%a%s%H%"%&%H$Oe(B2001/8e$B$G$9$M!#$?$7$+0U?^E*$J;EMMJQ99$@$C$?$h$&$J5$$,$7$^$9!#e(B

1 e$B9TL$H$N@09g@-$r9M$($k$H!"e(Byield e$B$N7k2L$,JV$C$F$-$?$[$&$,e(B

e$B$$$$$H;W$&$1$I!"%I%-%e%a%s%H$Oe(B true e$B$rJV$9$H8@$C$F$k$J$"e(B

e$B%I%-%e%a%s%H$N$[$&$NJQ99O3$l$@$H;W$$$^$9!#e(B