# Why does drb.rb depend on its filename?

**URL:** <https://www.ruby-forum.com/t/why-does-drb-rb-depend-on-its-filename/70246>\
**Category:** Ruby\
**Created:** [February 19, 2006, 1:54am UTC](https://www.ruby-forum.com/t/why-does-drb-rb-depend-on-its-filename/70246 "2006-02-19T01:54:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jay-levitt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e57/32.png) [@jay-levitt](https://www.ruby-forum.com/u/jay-levitt)\
**Post date:** [February 19, 2006, 1:54am UTC](https://www.ruby-forum.com/t/why-does-drb-rb-depend-on-its-filename/70246/1 "2006-02-19T01:54:48Z")

</div>

I was creating my first DRb server, and ran into a trouble with ACLs. I  
wanted to put a debug statement into DRb::Accept, so I copied it to my  
directory, renamed it jrb.rb, and required it with the new name. But  
when  
I did that, I got an error at launch:

…jrb.rb:1047: undefined method `to_s' for class`DRb::DRbObject’  
(NameError)

And the same error happened when I left jrb.rb in  
/usr/local/lib/ruby/1.8.  
So it’s not the path - it’s the filename.

What’s going on? It works fine when run as drb.rb.

Jay L.

---

<div class="post-metadata">

**Author:** ![jay-levitt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e57/32.png) [@jay-levitt](https://www.ruby-forum.com/u/jay-levitt)\
**Post date:** [February 19, 2006, 2:15am UTC](https://www.ruby-forum.com/t/why-does-drb-rb-depend-on-its-filename/70246/2 "2006-02-19T02:15:54Z")

</div>

On Feb 18, 2006, at 4:53 PM, Jay L. wrote:

> And the same error happened when I left jrb.rb in /usr/local/lib/  
> ruby/1.8.  
> So it’s not the path - it’s the filename.
> 
> What’s going on? It works fine when run as drb.rb.

It would be easier to tell you with an example.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://segment7.net](http://segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![jay-levitt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e57/32.png) [@jay-levitt](https://www.ruby-forum.com/u/jay-levitt)\
**Post date:** [February 19, 2006, 2:10pm UTC](https://www.ruby-forum.com/t/why-does-drb-rb-depend-on-its-filename/70246/3 "2006-02-19T14:10:17Z")

</div>

On Sun, 19 Feb 2006 10:13:44 +0900, Eric H. wrote:

> > What’s going on? It works fine when run as drb.rb.
> 
> It would be easier to tell you with an example.

$ cp /usr/local/lib/ruby/1.8/drb/drb.rb jrb.rb  
$ cat \> test.rb

#!/usr/local/bin/ruby

require “jrb”

def main  
DRb.start\_service(“druby://localhost:8000”, IceDrb.new())  
DRb.thread.join  
end

class IceDrb  
def message  
puts “message!”  
end  
end

main

---

<div class="post-metadata">

**Author:** ![jay-levitt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a88e57/32.png) [@jay-levitt](https://www.ruby-forum.com/u/jay-levitt)\
**Post date:** [February 19, 2006, 10:56pm UTC](https://www.ruby-forum.com/t/why-does-drb-rb-depend-on-its-filename/70246/4 "2006-02-19T22:56:34Z")

</div>

On Feb 19, 2006, at 5:08 AM, Jay L. wrote:

> require “jrb”

drb is more than one file so you need to fix your requires.

$ ruby test.rb  
./jrb.rb:1059: undefined method `to_s' for class `DRb::DRbObject’ (NameError)  
from test.rb:3  
$ cat -n jrb.rb | grep 1059  
1059 undef :to\_s  
$ grep require jrb.rb  
require ‘socket’  
require ‘thread’  
require ‘fcntl’  
require ‘drb/eq’  
[…]  
$ grep require /usr/local/lib/ruby/1.8/drb/eq.rb  
require ‘drb/drb’

–  
Eric H. - removed\_email\_address@domain.invalid - [http://segment7.net](http://segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)
