Hi --

On Sat, 1 May 2010, tilde wrote:

> Hi
> Someone knows why this source
>
> #! /usr/bin/env ruby
>
> require 'socket'
>
> srv = TCPServer.new 'localhost', 20000
> loop do
>    Thread.start (srv.accept) do |s|
>        s.write time.now
>        s.close
>    end
> end
>
>
> causes this?:
>
> code/ruby/stuff/socket.rb:5:in `<top (required)>': uninitialized constant 
> TCPServer (NameError)
> 	from ./socket.rb:3:in `require'
> 	from ./socket.rb:3:in `<main>'
>
>
> Also:
> ruby -v
> ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux]
>
> It seems to happen only to me =\

It happens to me too, when I name my file socket.rb and use Ruby
1.9.1. I'm not sure why, since "." (current directory) is at the very
end of the load path, but it appears to be loading your socket.rb
instead of the Ruby one.


David

-- 
David A. Black, Senior Developer, Cyrus Innovation Inc.

THE                   Ruby training with Black/Brown/McAnally
     COMPLEAT          Coming to Chicago area, June 18-19, 2010!
              RUBYIST  http://www.compleatrubyist.com