RubyInitHandler Problems

"Hammond, Tony" <[email protected]> Tue, 27 Jul 2004 10:25:20 +0100
Newsgroups gmane.comp.apache.mod-ruby
Message-ID <[email protected]>
Hi:

I am very new to mod_ruby and am clearly not understanding how to use the
RubyInitHandler directive. What I am trying to do is to call a method
'load_data' to read in a (large) data file, and have set this in the
httpd.conf file:

===
RubyRequire apache/ruby-run
RubyRequire foo/bar

<Files *.rbx>
  SetHandler ruby-object
  RubyInitHandler Foo::Bar.load_data
  RubyHandler Apache::RubyRun.instance
</Files>
===

I've even copied the Foo module into the standard library at
/usr/local/lib/ruby/1.8 out of desperation. But I just get the following in
the error log:

===
[Tue Jul 27 09:58:09 2004] [error] mod_ruby: error in ruby
(eval): (eval)undefined method `load_data' for Foo::Bar:Class
(NoMethodError)
        from (eval):0:in `value'
===

For some reason I can't even seem to see the method which is in the file
'foo/bar' as

===
module Foo

  class Bar

    def load_data

    ...

    end

  end

end
===
  
Any pointers would be helpful to allow me to accomplish this initialization
task.

Thanks,

Tony


Tony Hammond

New Technology, Nature Publishing Group
4 Crinan Street, London N1 9XW, UK 

tel:+44-20-7843-4659
mailto:[email protected]




********************************************************************************
DISCLAIMER: This e-mail is confidential and should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage mechanism. Neither Macmillan Publishers Limited nor any of its agents accept liability for any statements made which are clearly the sender's own and not expressly made on behalf of Macmillan Publishers Limited or one of its agents. Please note that neither Macmillan Publishers Limited nor any of its agents accept any responsibility for viruses that may be contained in this e-mail or its attachments and it is your responsibility to scan the e-mail and attachments (if any). No contracts may be concluded on behalf of Macmillan Publishers Limited or its agents by means of e-mail communication. Macmillan Publishers Limited Registered in England and Wales with
  registered number 785998 Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS
********************************************************************************