From: Bob Gustafson Date: 2001-09-18T09:33:23+09:00 Subject: [ruby-talk:21296] nested require files need path internally Version: 1.64 OS: Linux 2.4.0-test6 #1 Thu Aug 10 16:18:50 CDT 2000 i686 I had a piece of a program involving date manipulation. This piece started with the line require "date" (This referenced file /usr/local/lib/ruby/1.6/date.rb ) I needed this piece of program in another program, so I broke it off and put it into a local file named: date.rb I then added the line require "date.rb" in the file which had previously contained this piece, and in the program I was developing. -- What happened (I think) -- My file "date.rb" was read during the processing of the require "date.rb" statement in my main program. When the line (in date.rb) require "date" was read, the ruby compilation jumped to file /usr/local/lib/ruby/1.6/date.rb and continued reading. When the compilation reached the end of this file, the compilation processing jumped BACK TO THE MAIN PROGRAM, completely ignoring the rest of my "date.rb" file. Or, what might have happened: The line in my main program require "date.rb" caused the compilation process to go directly to the file: /usr/local/lib/ruby/1.6/date.rb IGNORING any files of the name "date.rb" in the local directory --- What I did to fix -- I just renamed my "date.rb" file to "mydate.rb" and changed the line in my old main program and my new development program to require "mydate.rb" This whole process cost me about an hour of time to figure out what was happening (There were no error messages until I tried to use something that was in my date.rb file beyond the require "date" line). -- Perhaps the 'require' file processing should first look for a file in the local directory with the exact name given, then if a file is not found, go to the system directory to look for a file with the same basename and .rb extension?