Error with open-uri (instance_eval?)

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

e$B$I$&$bC;$$:F8=%1!<%9$r:n$l$J$$$N$GJs9p$@$1$9$,!"8=:_$Ne(Btrunke$B$Ge(B
e$B0J2<$N$h$&$J%(%i!<$,=P$^$9!#e(B

% ruby -ropen-uri -ve ‘open(“http://www.ruby-lang.org/”)’
ruby 1.9.0 (2008-01-08 revision 0) [i386-netbsdelf]
/home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:411: warning: instance
variable @meta not initialized
/home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:411:in meta_add_field': undefined method []=’ for nil:NilClass (NoMethodError)
from /home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:326:in block in open_http' from /home/usa/ruby/lib/ruby/1.9.0/net/http.rb:1297:in block in
each_header’
from /home/usa/ruby/lib/ruby/1.9.0/net/http.rb:1296:in each' from /home/usa/ruby/lib/ruby/1.9.0/net/http.rb:1296:in each_header’
from /home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:326:in
open_http' from /home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:735:in buffer_open’
from /home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:197:in block in open_loop' from /home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:195:in catch’
from /home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:195:in
open_loop' from /home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:141:in open_uri’
from /home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:637:in open' from /home/usa/ruby/lib/ruby/1.9.0/open-uri.rb:33:in open’
from -e:1:in `’

open-uri.rbe$B$Ne(B386e$B9TL$+$i$Ne(Binstance_evale$B$r$d$a$Fe(Binstance_variable_set
e$B$KJQ$($k$H@5>o$KF0:n$9$k$N$G!“e(Binstance_evale$B$,$^$:$$$N$@$H;W$$e(B
e$B$^$9$,!”$h$/$o$+$j$^$;$s!#e(B
e$B$A$J$_$Ke(B2007-12-30e$B$N;~E@$G$O@5>o$KF0:n$7$F$$$^$7$?!#e(B

e$B$=$l$G$O!#e(B

e$B@>;3OB9-$G$9!#e(B

At Tue, 8 Jan 2008 18:19:29 +0900,
U.Nakamura wrote:

open-uri.rbe$B$Ne(B386e$B9TL$+$i$Ne(Binstance_evale$B$r$d$a$Fe(Binstance_variable_set
e$B$KJQ$($k$H@5>o$KF0:n$9$k$N$G!“e(Binstance_evale$B$,$^$:$$$N$@$H;W$$e(B
e$B$^$9$,!”$h$/$o$+$j$^$;$s!#e(B

Tempfilee$B$,e(BDelegateClass(File)e$B$Ge(Binstance_evale$B$,<B9T$5$l$k%%V%8%’%/%H$He(B
meta_add_fielde$B$,<B9T$5$l$k%
%V%8%’%/%H$,$:$l$F$7$^$&$N$,860x$N$h$&$G$9!#e(B

require “delegate”
module M
attr_reader :m
end
obj = DelegateClass(Array).new([])
obj.instance_eval { @m = :m }
obj.extend M
p obj.m

p obj.class
p Object.instance_method(:class).bind(obj).call

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:33116] Re: error with open-uri (instance_eval?)”
on Jan.15,2008 16:02:24, [email protected] wrote:
| > open-uri.rbe$B$Ne(B386e$B9TL$+$i$Ne(Binstance_evale$B$r$d$a$Fe(Binstance_variable_set
| > e$B$KJQ$($k$H@5>o$KF0:n$9$k$N$G!“e(Binstance_evale$B$,$^$:$$$N$@$H;W$$e(B
| > e$B$^$9$,!”$h$/$o$+$j$^$;$s!#e(B
|
| Tempfilee$B$,e(BDelegateClass(File)e$B$Ge(Binstance_evale$B$,<B9T$5$l$k%%V%8%'%/%H$He(B
| meta_add_fielde$B$,<B9T$5$l$k%
%V%8%'%/%H$,$:$l$F$7$^$&$N$,860x$N$h$&$G$9!#e(B

e$B$“$j$,$H$&$4$6$$$^$9!#e(B
e$B0J2<$N%Q%C%A$GLdBj$,2r7h$9$k$3$H$,$o$+$j$^$7$?!#e(B
e$B$3$NLdBj$O$?$V$s$3$l$G$$$$$s$G$9$,!”$3$&$$$&>lEv$?$j$JBP1~$Ge(B
e$B$$$$$s$G$7$g$&$+e(B…

Index: lib/delegate.rb

— lib/delegate.rb (revision 15059)
+++ lib/delegate.rb (working copy)
@@ -267,6 +267,7 @@ def DelegateClass(superclass)
:id, :object_id, :send, :public_send, :respond_to?, :send,
:==, :equal?, :initialize, :method_missing, :getobj,
:setobj,
:clone, :dup, :marshal_dump, :marshal_load, :instance_eval,
:instance_exec,

  • :extend,
    ]
    klass.module_eval {
    include Delegator::MethodDelegation

e$B$=$l$G$O!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33117] Re: error with open-uri
(instance_eval?)”
on Tue, 15 Jan 2008 17:12:31 +0900, “U.Nakamura”
[email protected] writes:

|e$B0J2<$N%Q%C%A$GLdBj$,2r7h$9$k$3$H$,$o$+$j$^$7$?!#e(B
|e$B$3$NLdBj$O$?$V$s$3$l$G$$$$$s$G$9$,!"$3$&$$$&>lEv$?$j$JBP1~$Ge(B
|e$B$$$$$s$G$7$g$&$+e(B…

e$B$&!<$`!"$3$l$OFq$7$$LdBj$G!#e(B

a->b

e$B$H$$$&4X78$,@.N)$7$F$$$k;~e(B(ae$B$,e(BDelegator)e$B!"e(B

a.extend(aModule)

e$B$O5!G=$re(Bae$B$KDI2C$9$Y$-$+!"e(Bbe$B$KDI2C$9$Y$-$+$H$$$&$H!“e(Bbe$B$J$s$8$ce(B
e$B$J$$$+$H;W$$$^$9!#$H$$$&$3$H$O!”$3$N%Q%C%A$8$c$^$:$$$o$1$G!#e(B

e$B$`$7$m!“e(Binstance_evale$B$rE>Aw$9$Y$-$J$N$+$J$”!#e(B