On Jul 14, 2006, at 6:55 PM, Just Another Victim of the Ambient  
Morality wrote:

> On my (MS Windows) system, I have a couple of programs to help me  
> live my electronic life and some of them are written in Ruby (are  
> they still called "programs" or are they "scripts?").  I keep all  
> these programs in a directory and have an execution path to them.
>
> I also have some patterns that come up time and time again in my  
> Ruby code so I have factored them out into their own files so I may  
> "require" them in any of my Ruby scripts.

Are those files in ruby's load path?

> The problem is that Ruby can't find them.  I had hoped that Ruby  
> would search for "required" files in the directory of the running  
> script but this doesn't appear to be the case.

Ruby does not.

> I could have used the magic "$0" variable but then I'd have to  
> operate on it before using it.  I also considered refactoring this  
> work and using that but...
>
> Is there anything I can do to get Ruby to find these "required"  
> scripts?

Ruby searches these paths:

ruby -e 'p $LOAD_PATH'

You can use the -I argument or the RUBYLIB environment variable to  
add paths to this.  You can also put your extra libraries in your  
site_ruby directory.

> I tried to call a PERL script from a Ruby script and that myseriously
> failed.  I did a search on groups.google and found that you need to  
> call the PERL interpreter, directly.  I found this a little odd  
> since PERL scripts have no problem calling other PERL scripts.   
> It's not a problem of the environment, since Ruby can call  
> executables in the execution path.

I don't believe you.  Please show us an error.

$ cat x.pl
#!/usr/bin/env perl

print "hi\n";

$ ruby -e 'system "./x.pl"'
hi

-- 
Eric Hodel - drbrain / segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com