~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to sample/drb/drbc.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=begin
 
2
 distributed Ruby --- dRuby Sample Client
 
3
        Copyright (c) 1999-2000 Masatoshi SEKI 
 
4
=end
 
5
 
 
6
require 'drb/drb'
 
7
 
 
8
class 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
 
18
end
 
19
 
 
20
if __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
 
45
end