I have two issues in Ruby which are bugging me.
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.
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. 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?
My second issue is not very serious but a curiosity to me. I used
to
use PERL so some of my useful “programs” are still written in that
language.
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.
So, what’s up with that? Why isn’t the Ruby interpreter like PERL
in
this respect?
Thank you for your help!