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 #<DRb::DRbUnknown:0xb72c2fec> (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:
--START--
require 'db/db'
require 'thread'

class Listener

  #---------------------------------------------------------------------------
  # Method:   initialize
  # Purpose:  Prepare listener to be able to direct behavior of backend
  # Pre:      Listener has none of the objects it needs to control the backend
  # Post:     Listener is prepped for use
  #---------------------------------------------------------------------------
  def initialize(db)
    @db = db
    @mutex = Mutex.new
  end

  #---------------------------------------------------------------------------
  # Method:   login
  # Purpose:  Allow user to login to the system
  # Pre:      User is not logged in
  # Post:     User is logged in and returned, or error is raised.
  #---------------------------------------------------------------------------
  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'

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!