From: Brian Candler Date: 2009-01-22T17:42:01+09:00 Subject: Re: class doesn't know about calling program's libraries? P.S. It would be extremely helpful if you could boil this down to a very short program which replicates the problem, and then post that program in its entirety. For example, when I write this: ---- 8< ----- # foo.rb def main Foo.new.bar end class Foo def bar Readline::readline(">>") end end %w(readline).each{ |lib| require lib } main ---- 8< ----- and type "ruby foo.rb" then it runs perfectly. The question is, what's different between this and what you posted? Does this program run correctly for you? If so, I suspect the problem lies somewhere outside what you posted. This whole process is extremely useful: 1. In the act of minimising the problem, you'll probably find the solution yourself. 2. Even if you don't, then you have made it as easy as possible for other people on the list to understand and/or replicate the problem, and hence to find the solution. The question then becomes simply: "The following piece of code raises the exception shown. Why?" Since line numbers in the exception will match up exactly to the posted code, an experienced coder will likely see the problem at once. Making life easy for other people makes them much more inclined to help you (both now and in the future), as does demonstrating that you've done your own homework. There's a very good article on this topic at http://www.catb.org/~esr/faqs/smart-questions.html Regards, Brian. -- Posted via http://www.ruby-forum.com/.