From: Alan Chen Date: 2002-02-21T04:12:44+09:00 Subject: Re: Global variables, mod_ruby On Thu, Feb 21, 2002 at 01:39:01AM +0900, Dan McNulty wrote: > I see Shugo stated (back in July 2001) that the use of global > variables when using mod_ruby doesn't work. I am using mod_ruby 0.9.7 > and it seems support for globals hasn't changed since July. > > I very much want to use globals since my alternatives are: > a) added complexity in the interfaces to certain of my functions > b) placing all my code into a single file > > I don't want to do either of those. Actually, I don't plan to use > globals in the long term, but it is simple and quick. I will do it > the right way later. > > Does anyone know of any plans to support globals properly using > mod_ruby, or is there a replacement for mod_ruby that does support > globals, or is there another alternative to globals besides "a" and > "b" that I don't know about? > > Thanks in advance for any help. > > -- Dan How exactly do you intend to use the globals? I'm not sure that you can ever expect to pass data between pages using global variables when you might have several different apache processes, each with a different "interpreter-space". Re: option b, your code can go into regular ruby files and be required into eruby pages or ruby scripts. You can split up your code however it best makes sense to you. I'm not sure how you'd like to use these globals, but if you have a number of related functions, you can put then into a common module or class. -- alan -- Alan Chen Digikata LLC http://digikata.com