required module automatically including, except in Debian

Discussion in 'Ruby' started by Phil Darnowsky, Mar 30, 2007.

  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

    --
    Posted via http://www.ruby-forum.com/.
     
    Phil Darnowsky, Mar 30, 2007
    #1
    1. Advertising

  2. Phil Darnowsky

    Guest

    On Fri, 30 Mar 2007, Phil Darnowsky wrote:

    > 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
    --
    be kind whenever possible... it is always possible.
    - the dalai lama
     
    , Mar 30, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Salerno
    Replies:
    20
    Views:
    881
    John Salerno
    Aug 11, 2006
  2. Fabio Z Tessitore

    who is simpler? try/except/else or try/except

    Fabio Z Tessitore, Aug 12, 2007, in forum: Python
    Replies:
    5
    Views:
    397
  3. Luke Kenneth Casson Leighton
    Replies:
    0
    Views:
    502
    Luke Kenneth Casson Leighton
    Dec 31, 2008
  4. David House

    try -> except -> else -> except?

    David House, Jul 6, 2009, in forum: Python
    Replies:
    2
    Views:
    364
    Bruno Desthuilliers
    Jul 6, 2009
  5. Peng Yu
    Replies:
    1
    Views:
    561
    Steven D'Aprano
    Nov 18, 2009
Loading...

Share This Page