From: Sean O'Dell Date: 2002-06-06T03:41:24+09:00 Subject: Re: mod_ruby and module space Kent Dahl wrote: > Sean O'Dell wrote: > >>Oh, did I use require in my example...oops. Yes, I use load, require >>doesn't work. The problem isn't loading the module, it's using >>functions within a module. When I call functions from one ruby file >>which has loaded another ruby file, I can't call any module functions in >>that other ruby file from the first ruby file. >> > > Well, using those functions worked for me when I loaded the module as an > .rb file. > > Uhm, not sure what I did, but this works for me: > > # script2.rb # Notice, no X > module TestMod > def TestMod::test() > print("test") > end > end > > # > > script1.rbx > load "script2.rb" # Or require "script2" as suggested by James > TestMod::test() > puts # Without this, Netscape replies "Document contained no data." > > Looks like perhaps some flushing problem in mod_ruby? I get "test" as a > result by this on my server. > I'm on ruby 1.6.7 (2002-03-01) [i586-linux], with mod_ruby-0.9.8 Actually, my actual test over here used an .rb file, not an .rbx...but it shouldn't make a difference with require/load, eh? So, you can call module functions in one script file from other script files in mod_ruby? Weird...I wonder what the heck is going on. Sean