From: Eric Hodel Date: 2005-08-26T17:08:27+09:00 Subject: Re: DRb functions disappearing? On 26 Aug 2005, at 00:32, Kevin Brown wrote: > On Friday 26 August 2005 01:14, Eric Hodel wrote: > >> On 25 Aug 2005, at 21:49, Kevin Brown wrote: >> >>> Here's the output: >>> >>> (druby://localhost:9000) ./db/db.rb:999:in `login': undefined >>> method `login' >>> for # (NoMethodError) >>> >> >> ^^^ >> Looks like you're missing a DRbUndumped somewhere. >> >> How about some code? >> > > Your wish is my command. > > Here's the backend code: > --START-- > require 'db/db' > require 'listener' > require 'drb' > > # Initialize Database Connection > db = DB.new > > # Start Listener > listener = Listener.new(db) > listener.extend DRb::DRbUndumped > DRb.start_service('druby://localhost:9000', listener) > > puts "DLI server is up and running...\n" > > DRb.thread.join > --END-- > > DB is a database abstraction layer, listener maps calls to it, only > allowing > access to login for now. > > Here's listener, not like it matters much: The listener isn't involved in the failure, right? > --START-- > require 'db/db' > require 'thread' > > class Listener > > def initialize(db) > @db = db > @mutex = Mutex.new > end > > def login(user) > @db.login(user) > end > end > --END-- > > And the client code is in a KDE app, so I won't bore you all with > the pile > there: > --START-- > require 'Korundum' > require 'drb' > require 'errors' > require 'login' I don't see require 'db/db' here, so you'll need to add 'include DRbUndumped' to db/db if you don't want db/db to live here. > class Dli < KDE::MainWindow > attr_reader :connection > > slots 'newUser()' > > def initialize(name) > super(nil, name) > > # Prepare messenger to get to backend. > DRb.start_service() > @connection = DRbObject.new(nil, 'druby://localhost:9000') > user = User.new > @connection.login(user) > --END-- > The connection.login is the "disappearing" method... And that's > all the code > that has to do with that. :-) > > Thanks for the quick reply! > -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04