From: rpardee@... (Roy Pardee) Date: 2004-11-06T08:23:44+09:00 Subject: nuby sanity check--do I have a right to be confused by this error msg? Hey All, If I run this script (ruby 1.8.2 (2004-07-29) [i386-mswin32] on win2k): # --------------------------------------- require "net/http" PROXYSERVER = "proxy.ghc.org" PROXYPORT = 8080 my_array = ["rama", "lama", "ding"] def someMethod Net::HTTP.Proxy(PROXYSERVER, PROXYPORT).start("www.ruby-doc.org") do |http| my_array += ["dong"] end end puts my_array someMethod # --------------------------------------- I get this for output: C:\>ruby httperr.rb rama lama ding httperr.rb:12:in `someMethod': undefined method `+' for nil:NilClass (NoMethodEr ror) from httperr.rb:11:in `start' from c:/program files/ruby/lib/ruby/1.8/net/http.rb:324:in `start' from httperr.rb:11:in `someMethod' from httperr.rb:18 Can anybody tell me why my backtrace seems to implicate http.rb? I was chasing my tail for quite a bit on that one. (At one point I figured there was just something wrong w/http.rb on windows & was regex searching the backtrace for "http.rb:324" to see if I could disregard the error. Silly me.) [And I'm still wondering why my_array is not visible inside someMethod. If I make the var name @my_array all is well, which is also confusing since I'm not in a class def, so why should I need an instance var...] Thanks! -Roy