From: Eric Hodel Date: 2003-02-05T02:39:03+09:00 Subject: Re: postgres/drb experts [or hi eric ;-)] --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable ahoward (ahoward@fsl.noaa.gov) wrote: >=20 > drb'ing ruby'ists- >=20 > i am confused (in general, but especially on this topic) : >=20 > i was under the impression that if one was to NOT include DRbUndumped in a > class that client's using the class remotely would be required to load any > client libraries. if that is the case, then this would not work, and yet= it > does? >=20 > ~/eg/ruby/dpostgres > cat s.rb && s.rb >=20 > #!/usr/bin/env ruby > require 'postgres' > require 'drb' > DRb.start_service 'druby://localhost:5000', PGconn.new > DRb.thread.join >=20 >=20 > ~/eg/ruby/dpostgres > cat c.rb && c.rb >=20 > #!/usr/bin/env ruby > require 'drb' > DRb.start_service > pgconn =3D DRbObject.new nil, 'druby://localhost:5000' > pgresult =3D pgconn.exec (ARGV.shift or 'select * from foo') > p pgresult.result > pgresult.clear >=20 > [["2003-02-04 10:23:34.522356-07", "2003-02-05 00:00:00-07"]] >=20 >=20 > note that the client does __NOT__ do "require 'postgres'" ??? Mayhap this is happening: def dump(obj, ary) obj =3D DRbObject.new(obj) if obj.kind_of? DRbUndumped begin str =3D Marshal::dump(obj) rescue ro =3D DRbObject.new(obj) str =3D Marshal::dump(ro) end ary.push([str.size].pack('N') + str) if ary return str end try this: ruby -r postgres -e "Marshal::dump(PGConn.new)" If you get an exception, then DRb DTRT (Did The Right Thing) and wrapped the un-dumpable object in a proxy for you. :) Note that DRb does the right thing with this: require 'drb' DRb.start_service('druby://localhost:5000', File.new('server.rb')) DRb.thread.join --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (FreeBSD) iD8DBQE+P/q0MypVHHlsnwQRAmLUAKCJeGe7/sMlEfBgEiG65ohon/+3nQCfTCzP cUOZuk3l51i8RqHqB4TXUx8= =lD1x -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE--