mod_ruby is making me CRAZY

Discussion in 'Ruby' started by Javier Valencia, Feb 22, 2005.

  1. I'm just crazy, i can't understand anything.
    I have two modules: Iptstats and Mods

    Code for ipstats is large, but works fine ( a normal module )
    Code for Mods is (it don't do nothing right now) :

    module Mods

    public

    def Mods.get()
    a = Array.new
    end

    end


    and my sample menu.rb cgi is:

    require "mods"

    Mods.get()


    Well, mod_ruby give me the following FUNNY error:

    [Tue Feb 22 23:53:23 2005] [error] mod_ruby: error in ruby
    [Tue Feb 22 23:53:23 2005] [error] mod_ruby:
    /var/www/localhost/htdocs/menu.rb:3: uninitialized constant
    #<Module:0x405ceaac>::Mods (NameError)


    What the hell is happening here? I don't understand why my other module
    works and this one not.
    sorry i'm a bit frustrated.
    Javier Valencia, Feb 22, 2005
    #1
    1. Advertising

  2. "Pit Capitain" <> schrieb im Newsbeitrag
    news:...
    > Javier Valencia schrieb:
    > > I'm just crazy, i can't understand anything.
    > > I have two modules: Iptstats and Mods
    > >
    > > Code for ipstats is large, but works fine ( a normal module )
    > > Code for Mods is (it don't do nothing right now) :
    > >
    > > module Mods
    > >
    > > public
    > > def Mods.get()
    > > a = Array.new
    > > end
    > >
    > > end
    > >
    > >
    > > and my sample menu.rb cgi is:
    > >
    > > require "mods"
    > >
    > > Mods.get()
    > >
    > >
    > > Well, mod_ruby give me the following FUNNY error:
    > >
    > > [Tue Feb 22 23:53:23 2005] [error] mod_ruby: error in ruby
    > > [Tue Feb 22 23:53:23 2005] [error] mod_ruby:
    > > /var/www/localhost/htdocs/menu.rb:3: uninitialized constant
    > > #<Module:0x405ceaac>::Mods (NameError)
    > >
    > >
    > > What the hell is happening here? I don't understand why my other

    module
    > > works and this one not.
    > > sorry i'm a bit frustrated.

    >
    > I've never used mod_ruby myself, but it seems that menu.rb is run in an
    > anonymous module, just like
    >
    > load "menu.rb", true
    >
    > So it tries to find the constant "Mods" in the namespace of this

    anonymous
    > module. If this is the case, try using
    >
    > ::Mods.get()
    >
    > in menu.rb in order to get at the global namespace.


    Another thing that could possibly go wrong is that the file that's loaded
    by "require 'mods'" is a different file and does not contain module Mods.

    Regards

    robert
    Robert Klemme, Feb 23, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lh
    Replies:
    2
    Views:
    1,005
  2. Replies:
    5
    Views:
    1,865
    Andrew Thompson
    Jan 12, 2005
  3. Carl Youngblood

    mod_ruby under windows

    Carl Youngblood, Jul 22, 2003, in forum: Ruby
    Replies:
    4
    Views:
    151
    Gawnsoft
    Jul 23, 2003
  4. Carl Youngblood

    Web tools for mod_ruby - Dave Thomas

    Carl Youngblood, Jul 25, 2003, in forum: Ruby
    Replies:
    0
    Views:
    75
    Carl Youngblood
    Jul 25, 2003
  5. Robert McKinnon
    Replies:
    1
    Views:
    167
    Dave Thomas
    Mar 6, 2004
Loading...

Share This Page