From: ptkwt@... (Phil Tomson) Date: 2005-08-06T16:31:10+09:00 Subject: Re: Remote require In article <42F44817.4050207@neurogami.com>, James Britt wrote: >Assume there is actual code underneath (probably involving open-uri), >and that I've got soul.rb, and I'm superbad.com > ># File soul.rb lives on a remote Web server >$:.push( 'http://www.superbad.com' ) > >require 'soul' # Fetch from server if not found locally > > >Has anyone already implemented something like (I expect why_ to speak up >here)? > >I should probably use hack 'require' to use open-uri, and play around, >but it's late and just wanted to toss this out. > >What are the less-obvious issues with this way of fetching code? Let's >assume crypto code signing and authentication and the like. > > >James > Did something like this long ago in TaskMaster (Warning: I haven't touched that code in years and as far as I know it doesn't work in 1.8.x). Wasn't a webserver, but a drb server. Sent the code over via drb as I recall. One issue to consider (which I did not solve) is the issue of extensions - you should probably send the C code over (or C++ if that's what you're using) and compile it on the machine doing the require in case it has a different processor/OS (as opposed to sending the .so file). It would be cool if remote require worked with extensions as well. We could really use something like this packaged up seperately in a library/module - [I would recommend not using the code from TaskMaster as an example it was written early on in my Ruby career and that was also prior to the existence of open-uri.] Phil