From: Kent Dahl Date: 2002-06-06T06:01:39+09:00 Subject: Re: mod_ruby and module space Kent Dahl wrote: > I have an idea what is going on, but I'm going to investigate a bit > more, just in case I'm sticking my foot in my mouth. But for now, I'm > getting > /home/httpd/html/ruby/test/testscr.rbx:10: > undefined method `testfunc' for > #::TestMod (NameError) > and the nameless module before TestMod makes me think that mod_ruby is > wrapping the loaded code, to avoid it cluttering the namespace of other > mod_ruby programs? And this might confuse you (and Ruby) with regards to > just which TestMod you are accessing. Ah, yes, try this on for size: module TestMod end load "testmod.rb" puts TestMod.to_s ::TestMod::testfunc() puts "---#{TestMod::methods.size} vs #{::TestMod::methods.size}---" Which retorts "---60 vs 61---" to me. It seems like the load of the script is wrapped in the nameless module, but anything that script requires or loads goes to the toplevel non the less. Still haven't found the source in mod_ruby that does this, but I'm convinced :-) -- (\[ Kent Dahl ]/)_ _~_ __[ http://www.stud.ntnu.no/~kentda/ ]___/~ ))\_student_/(( \__d L b__/ NTNU - graduate engineering - 4. year ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)