G
Ged Byrne
I'm working through "Programming Ruby - The Pragmatic
Programmer's Guide" and all has been joy and pleasure.
Now, however, I'm in difficulty.
From the IO chapter I'm running the following example:
require 'net/http'
h = Net::HTTP.new('www.pragmaticprogrammer.com', 80)
resp, data = h.get('/index.html', nil)
puts resp.message #I added this
puts data #And this
if resp.message == "OK"
#Spam assasin didn't like the Img tag in the re.
data.scan(/###/) { |x| puts x }
end
The result I'm getting is:
OK
nil
listimgs.rb:8: private method `scan' called for nil
(NoMethodError)
The code should list the images on the pragprog home
page.
Any idea whats going wrong, or how I can find out more
about whats going wrong.
I'm using 1.8.0-9
________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/
Programmer's Guide" and all has been joy and pleasure.
Now, however, I'm in difficulty.
From the IO chapter I'm running the following example:
require 'net/http'
h = Net::HTTP.new('www.pragmaticprogrammer.com', 80)
resp, data = h.get('/index.html', nil)
puts resp.message #I added this
puts data #And this
if resp.message == "OK"
#Spam assasin didn't like the Img tag in the re.
data.scan(/###/) { |x| puts x }
end
The result I'm getting is:
OK
nil
listimgs.rb:8: private method `scan' called for nil
(NoMethodError)
The code should list the images on the pragprog home
page.
Any idea whats going wrong, or how I can find out more
about whats going wrong.
I'm using 1.8.0-9
________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/