1=begin 2 distributed Ruby --- dRuby Sample Client 3 Copyright (c) 1999-2000 Masatoshi SEKI 4=end 5 6require 'drb/drb' 7 8class DRbEx2 9 include DRbUndumped 10 11 def initialize(n) 12 @n = n 13 end 14 15 def to_i 16 @n.to_i 17 end 18end 19 20if __FILE__ == $0 21 there = ARGV.shift 22 unless there 23 $stderr.puts("usage: #{$0} <server_uri>") 24 exit 1 25 end 26 27 DRb.start_service() 28 ro = DRbObject.new_with_uri(there) 29 30 puts ro 31 p ro.to_a 32 puts ro.hello 33 p ro.hello 34 puts ro.sample(DRbEx2.new(1), 2, 3) 35 puts ro.sample(1, ro.sample(DRbEx2.new(1), 2, 3), DRbEx2.new(3)) 36 37 begin 38 ro.err 39 rescue DRb::DRbUnknownError 40 p $! 41 p $!.unknown 42 rescue RuntimeError 43 p $! 44 end 45end 46