From: m_seki@... Date: 2001-11-27T08:05:41+09:00 Subject: [ruby-talk:26569] Re: DRbUndumped question Hi, Phil. (repost) > here's part of the Client.rb file: > require 'drb' > class Client > > def initialize > ... > end > > def run(taskObj, *args) > taskObj.run(args) #an object that must respond to 'run' > end > end > > if $0 == __FILE__ > clientObj = Client.new > DRb.start_service('druby://0.0.0.0:9000',clientObj) > DRb.thread.join > end > #end of Client.rb > > Here's the Task.rb file which defines a Task class and then attempts to > send a Task object to Client running on 'remote': > > require 'drb' > class Task > include DRb::DRbUndumped > def initialize > end > > def run(*args) > puts "Task::Run - running #{args}" > end > end > > if $0 == __FILE__ > DRb.start_service() > client = DRbObject.new(nil,'druby://remote:9000') > puts client.run(Task.new, "ftp","xyz","abc") > end > #end of Task.rb > So, my question is, what exactly does including DRbUndumped do? (I > thought it was to mixin to your own classes so that they could be passed > by reference to the remote DRbObject, but now I think I misunderstand > how to use it). Yes, DRbUndumped is mix-in class for passed by reference. I drew sequence chart. * http://www2a.biglobe.ne.jp/~seki/ruby/ruby-talk-26474.png In the case of include DRbUndumped: A Task object is in 'local', and pass a referecne of it. 'run' message is received by aTask in 'local'. The other case: A Task object is in 'local', and pass a copy of it to 'remote'. 'run' message is received by aTask in 'remote'. Seki. (sorry, I'm verrry poor at English. Please see the chart)