From: chad fowler Date: 2001-02-25T08:26:57+09:00 Subject: [ruby-talk:11493] Re: XML-RPC and KDE --- Michael Schuerig wrote: > Michael Neumann wrote: > > > Michael Schuerig wrote: > > > > > > Ruby has an XML-RPC package and KDE has the > XmlRpc Daemon. See > > > > > > > and > . > > > > Try following piece of code: > > > > require "xmlrpc/client" > > port, auth = File.readlines(ENV['HOME'] + > '/.kxmlrpcd').to_s.split(',') > > server = XMLRPC::Client.new("localhost", > "/kdesktop", port) > > begin > > > server.call("KDesktopIface.popupExecuteCommand", > auth) > > rescue XMLRPC::FaultException => e > > p "Error: ", e.faultCode, e.faultString > > end > > > > I have not tested it, but it should work. > > Thanks, it does. > > The Python code has the nice feature, that remote > calls look as if they > were instance methods of the client class: > > > server = Server("http://localhost:" + port > +"/kdesktop") > > > server.KDesktopIface.popupExecuteCommand(auth); > > Could something like that be done in Ruby? Possibly > with the help of > method_missing? Might look something like (untested) this: def XMLRPC::Client def method_missing(sym, *args) return call(sym.id2name, args) end end __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/