On 6/27/06, Zeljko Filipin <[EMAIL PROTECTED]> wrote:
The funny thing is that I get "false" after I type 'require "watir"'.
It should be "true", right? And, watir works, as if I did not get
"false".

irb(main):001:0> require "watir"
=> false

You get false if it is loaded as a gem. True if the file is in your $LOAD_PATH. Most people seem to think this is a bug in ruby gem software.
 
The other thing, I get that warning messages even if I do not type
'require "watir"' before 'require "Watir"'. And, of course, watir
works that way too.

I can explain this.

First of all, you have to understand that if you do
  require 'watir'
and
  require './watir'

You'll get the same warning messages. This is because the library is loaded twice. And this is because the library is associated literally with how it was required. Require it using a slightly different path that resolves to the same file, it is loaded again.

And you see that the same thing happens if you do
  require 'watir'
and
  require 'Watir'
for the same reasons.

OK?

So why does require 'Watir' itself also cause the watir library to be loaded twice?

My guess is that watir.rb itself requires files that in turn "require 'watir'" -- this gives you your second require name. There are a number of related libraries in watir, and normally these kinds of circular references are harmless. Actually, even in this case, they still are. It's just a warning. And you really shouldn't be doing 'require "Watir"' in the first place.

Bret

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to