[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:02133] Re: Question the sequence in $:

From: matz@... (Yukihiro Matsumoto)
Date: 2000-03-24 14:58:58 UTC
List: ruby-talk #2133
Hi,

In message "[ruby-talk:02129] Question the sequence in $:"
    on 00/03/24, Clemens Hintze <c.hintze@gmx.net> writes:

|As you can see the local directory "." is at the end of the load
|path. That means, that my current directory is the last one to be
|searched for libs.
|
|Is this intended?

Yes, It's intended.  Mostly because security reason.  If you want to
load your own file, I think you should express it explicitly.

But you can use RUBYOPT environment variable for your purpose.

  export RUBYOPT
  RUBYOPT='I."
  ruby -e 'p $LOAD_PATH'
  [".", "/usr/lib/ruby/site_ruby/1.5/i586-linux", "/usr/lib/ruby/site_ruby/1.5", "/usr/lib/ruby/site_ruby", "/usr/lib/ruby/1.5/i586-linux", "/usr/lib/ruby/1.5", "."]

|I think everywhere the sequence should be: 
|
|   local -> site -> system
|
|Other opinions?

I think relative path is too dangerous.  BTW, the sequence in the
Perl's load path is reversed somehow.

|And while thinking about this, I have another proposal. How about to
|include the directory from where the program was started into the load
|path too? That would enable me to put my application with its support
|libs into an own subdirectory and after starting, the load path would
|already contain this directory too! So its support libs could easily
|be required too. But this should only happen, of course, if $0 is not
|'-' or '-e'.

I can understand you.  But `$0' path is not portable.

							matz.

In This Thread