Roger Pack
4/15/2007 1:52:00 AM
you could try
require "./BNAbudgetperiods"
If that works, I consider I consider it a ruby bug to not check the
current directory for libs.
On Mar 5, 1:37 pm, Brian Candler <B.Cand...@pobox.com> wrote:
> On Sat, Mar 03, 2007 at 06:11:52AM +0900, Peter Bailey wrote:
> > Raj Sahae wrote:
> > >> Is there
> > >> something special I need to do in the hierarchy of Ruby script locations
> > >> so that other scripts can respect any other script I want to require?
> > >> These two scripts are in the same directory
> > > There are a couple ways to solve this problem. I don't know if there is
> > > a best way. Hopefully someone with more experience can shed light on
> > > that for me. But the problem you are having is that your scripts are
> > > not in a directory that is included when ruby searches for the files
> > > that you require. To solve this, I simply add the directory to the path
> > > variable "$:".
>
> > > So, if you are keeping scripts called myscript.rb and otherscript.rb in
> > > a folder c:\myfolder, then in your script you would say
>
> > > $: << "c:/myfolder/"
> > > require "myscript"
> > > require "otherscript"
>
> > Raj,
> > I got an "unexpected tLSHFT" error message when I put that $: line at
> > the top.
>
> Try:
>
> $:.unshift("c:/myfolder/")
>
> (I don't see why the << syntax wouldn't work. unshift has the advantage of
> putting your directory at the *front* of the library search path, which
> allows you to override existing modules should you so wish)