Prev: Using multicore CPUs in parallel tasks
Next: Ruby doesn't implement x++ for Fixnum's because ???
From: Ace Mutha on 29 Oct 2009 12:21 Hi all I have this prog taken from a book. require 'net/http' pages = ["www.rubycentral.com", "www.awl.com", "www.davidecasale.com"] threads = [] pages.each do |page| threads << Thread.new(page) { |myPage| h = Net::HTTP.new(myPage, 80) puts "Fetching: #{myPage}" resp, data = h.get('/', nil ) puts "Got #{myPage}: #{resp.message}" } end but when i run it It gives me this error. /usr/local/lib/ruby/1.9.1/net/http.rb:809:in `get': undefined method `keys' for nil:NilClass (NoMethodError) from Threads.rb:19:in `block (2 levels) in <main>' It's weird because it's working on ruby 1.8.7 -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: Using multicore CPUs in parallel tasks Next: Ruby doesn't implement x++ for Fixnum's because ??? |