I'm (brand) new to Ruby, so treat my questions in that light. On trying to install Beast (web forum software on Rails) I am required to test that requiring fcgi, or fcgi.so returns true from within irb.
$ irb
irb(main):001:0> require fcgi.so
NameError: undefined local variable or method `fcgi' for main:Object
from (irb):1
I guessed that there may be an issue with paths, so tried the full path to the lib.
irb(main):002:0> require /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.so
SyntaxError: compile error
(irb):2: unknown regexp options - lb
(irb):2: no .<digit> floating literal anymore; put 0 before dot
require /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.so
^
(irb):2: parse error, unexpected tINTEGER
require /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.so
^
from (irb):2
The above has worked before (ie. using the full path), giving the output 'true'.
I have two questions.
1) How do I configure things so that I don't have to specify the full path to a lib.
2) How do I resolve the above error? Should I be speaking to the ruby-fcgi guys?
OS slackware linux
ruby 1.8.5-p2
ruby fcgi 0.8.7
fcgi 2.4.0
I'm (brand) new to Ruby, so treat my questions in that light. On trying to install Beast (web forum software on Rails) I am required to test that requiring fcgi, or fcgi.so returns true from within irb.
$ irb
irb(main):001:0> require fcgi.so
NameError: undefined local variable or method `fcgi' for main:Object
from (irb):1
Hi Dale, welcome to Ruby!
You have to put quotes around fcgi, like
require "fcgi"
or
require "fcgi.so"
Otherwise Ruby tries to find a local variable or a method called fcgi, and then you get the NameError you've shown.
Thanks for the advice Pit, but there still appears to be a path issue? Any other suggestions? Thanks.
$ irb
irb(main):001:0> require "fcgi"
LoadError: no such file to load -- fcgi
from (irb):1:in `require'
from (irb):1
irb(main):002:0> require "fcgi.so"
LoadError: no such file to load -- fcgi.so
from (irb):2:in `require'
from (irb):2
irb(main):003:0>
Pit Capitain wrote:
···
You have to put quotes around fcgi, like
require "fcgi"
or
require "fcgi.so"
Otherwise Ruby tries to find a local variable or a method called fcgi, and then you get the NameError you've shown.
Thanks for the advice Pit, but there still appears to be a path issue? Any other suggestions? Thanks.
$ irb
irb(main):001:0> require "fcgi"
LoadError: no such file to load -- fcgi
from (irb):1:in `require'
from (irb):1
irb(main):002:0> require "fcgi.so"
LoadError: no such file to load -- fcgi.so
from (irb):2:in `require'
from (irb):2
irb(main):003:0>
If you are going to work with rubygems more often, it is a good idea to add RUBYOPT=-rubygems to your .bash_rc. This allows you to just use require "library|code_snippet" in the future.
I'm impressed by the immediate and useful help from folks on this ML so far! Much appreciated!
Dale
cmdjackryan@googlemail.com wrote:
···
If you are going to work with rubygems more often, it is a good idea to add RUBYOPT=-rubygems to your .bash_rc. This allows you to just use require "library|code_snippet" in the future.