Required module automatically including, except in Debian


#1

Dear everyone,

I’ve recently joined a project which has some code analagous to this:

included.rb:

OUTER_CONST = ‘foo’
module Included
INNER_CONST = 42
end

includer.rb:

require ‘included’
puts OUTER_CONST # => foo
puts INNER_CONST # => 42 (but why does this work?)

Now, you’ll notice that includer.rb does require included, but never
actually includes it–yet in this setup, everyone swears up and down,
with logs to back it up, that it works. Before I came on, it was a
mixed Gentoo Linux/OS X/FreeBSD development environment, and apparently
it worked in all three of these OSes, but not in the new Debian box I
set up.

I’ve been back and forth through the Pickaxe book and the Web trying to
find out what might make these three environments behave this way, but
not Debian. The Debian box and FreeBSD are both running Ruby 1.8.5, the
others I don’t have access to at the moment. The Gentoo machine does
have their special -rauto_gem in RUBYOPT, but when I tried replicating
auto_gem.rb on the Debian box it didn’t help–included.rb isn’t a gem
anyhow.

I am truly stumped, and I’m not alone in this. Anyone have any
thoughts? Thanks if you do!

–Phil


#2

On Fri, 30 Mar 2007, Phil Darnowsky wrote:

actually includes it–yet in this setup, everyone swears up and down,
auto_gem.rb on the Debian box it didn’t help–included.rb isn’t a gem
anyhow.

I am truly stumped, and I’m not alone in this. Anyone have any
thoughts? Thanks if you do!

grep the source for ‘const_missing’. someone may have done something
strange
with it. another thing is that require itself may have been overriden.

-a