From: Brad Hilton Date: 2002-03-02T03:49:59+09:00 Subject: druby question (bug?) Hello, I am experimenting with druby and have a couple of questions for anyone who may be more familiar with the code. I am using ruby 1.6.6 and drb 1.3.4.2. I find that with simple objects (where all elements are dumpable), DRb on the client side tries to filter out undefined methods. However, as soon as the object contains a Proc object or something which can't be dumped, the client side DRb simply passes the method calls to the server and lets it determine whether the method is valid. In my case I'd prefer the latter behavior always, because DRb seems to raise errors when it shouldn't. So, two questions: 1) Is there a way to force DRb to always pass methods back to the server and let the server decide on the method's validity? Or, to put it a different way, is there a way to force DRb to only pass object ids back and forth across the wire instead of the stringified object? 2) Does my sample code below work as expected? Should DRb really raise an error "undefined method 'serverName'" ? Note that in server.rb, if you uncomment the @proc line, things work and DRb seems to only pass back and forth ruby objects' internal ids. I would like DRb to behave this way always if possible. Here is some sample code which illustrates my problem: server.rb ------------------------- #!/usr/bin/env ruby require 'drb' class Proxy attr_reader(:serverName) def initialize @serverName = 'ftp.foo.com' # to make things work, just uncomment the following line: # @proc = Proc.new { } end end class Server def authenticate proxy = Proxy.new return proxy end end server = Server.new DRb.start_service('druby://localhost:9001', server) # wait for the threads to finish serving requests DRb.thread.join --------------------------------------------------------- client.rb ----------------------------------- #!/usr/bin/env ruby require 'drb' DRb.start_service() server = DRbObject.new(nil, 'druby://localhost:9001') proxy = server.authenticate puts proxy.serverName ----------------------------------- Thanks! -Brad