required module automatically including, except in Debian

P

Phil Darnowsky

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
 
A

ara.t.howard

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!

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top