From: Pen Ttt on
would you mind to tell me how to fix it, to make the following program
to run?
require 'rubygems'
require 'open-uri'
url="www.123.com"
open(url){|file| if url don't exists then puts "url don't exists"
else puts "url exists"}
thiks
--
Posted via http://www.ruby-forum.com/.

From: Pen Ttt on
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'open-uri'
=> true
irb(main):003:0> url = URI.parse('www.123.com')
=> #<URI::Generic:0xb764ff84 URL:www.123.com>
irb(main):004:0> status = Net::HTTP.start(url.host, url.port) {|http|
irb(main):005:1* http.head(url.path)
irb(main):006:1> }
NameError: uninitialized constant Net
from (irb):4
from :0
irb(main):007:0> puts( /^2/ =~ status.code ? "ok" : "nok" )
NoMethodError: undefined method `code' for nil:NilClass
from (irb):7
from :0
??
--
Posted via http://www.ruby-forum.com/.

From: Jean-Julien Fleck on
> NameError: uninitialized constant Net

require 'net/http'

--
JJ Fleck
PCSI1 Lycée Kléber