Re: Require stops working

Ben Gribaudo <[email protected]> Mon, 13 Feb 2006 09:26:20 -0600
Newsgroups gmane.comp.apache.mod-ruby
Message-ID <[email protected]>
Hi Brian,

> That's correct, this is normal behaviour.
> 
> "require" only loads the library if it has not already been loaded. This
> state is kept in a global variable, $" or $LOADED_FEATURES

Thanks! I felt like I was missing something simple. :-)

Ben




Brian Candler wrote:

> [snip]
>
>That's correct, this is normal behaviour.
>
>"require" only loads the library if it has not already been loaded. This
>state is kept in a global variable, $" or $LOADED_FEATURES
>
>If your Apache server has spawned 5 worker processes, then each will have a
>ruby interpreter in it. The first time that particular worker processes
>test.rhtml, it will load the library. Once done, that interpreter instance
>has it and won't load it again.
>
>If you want to *force* Ruby to load the library on every page hit, use
>'load' instead of 'require'
>
>Brian.
>
>  
>