* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git] / sample / drb / drbc.rb
blob00132b46c834693aba61d3d82a66f6967ab18049
1 =begin
2  distributed Ruby --- dRuby Sample Client
3         Copyright (c) 1999-2000 Masatoshi SEKI 
4 =end
6 require 'drb/drb'
8 class DRbEx2
9   include DRbUndumped
11   def initialize(n)
12     @n = n
13   end
15   def to_i
16     @n.to_i
17   end
18 end
20 if __FILE__ == $0
21   there = ARGV.shift
22   unless there
23     $stderr.puts("usage: #{$0} <server_uri>")
24     exit 1
25   end
27   DRb.start_service()
28   ro = DRbObject.new_with_uri(there)
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))
37   begin
38     ro.err
39   rescue DRb::DRbUnknownError
40     p $!
41     p $!.unknown
42   rescue RuntimeError
43     p $!
44   end
45 end