[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby and library paths

Dale

1/25/2007 7:35:00 AM

Hi there

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
from :0

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

Thanks
Dale

9 Answers

Pit Capitain

1/25/2007 8:10:00 AM

0

Dale schrieb:
> 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.

Regards,
Pit

Dale

1/25/2007 8:18:00 AM

0

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.

Dale

1/25/2007 8:20:00 AM

0

This does work though... absolute path to lib, so there must be a path
issue in terms of irb's environment?

irb(main):003:0> require
"/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.so"
=> true

Dale wrote:
> 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

1/25/2007 8:29:00 AM

0

Dale schrieb:
> This does work though... absolute path to lib, so there must be a path
> issue in terms of irb's environment?
>
> irb(main):003:0> require
> "/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.so"
> => true

Hi Dale, I have no Linux, so I can't tell you much more. But to be able
to use gems, you first have to load the ruygems library itself. So try

require "rubygems"
require "fcgi"

If this doesn't work, someone else has to help you further.

Regards,
Pit

Dale

1/25/2007 8:47:00 AM

0

Ha! Super! You were spot on. Thanks!

$ irb
irb(main):001:0> require "rubygems"
=> true
irb(main):002:0> require "fcgi"
=> true
irb(main):003:0>

Pit Capitain wrote:
> Hi Dale, I have no Linux, so I can't tell you much more. But to be able
> to use gems, you first have to load the ruygems library itself. So try
>
> require "rubygems"
> require "fcgi"

Phillip Gawlowski

1/25/2007 9:04:00 AM

0

Dale schrieb:
> Ha! Super! You were spot on. Thanks!
>
> $ irb
> irb(main):001:0> require "rubygems"
> => true
> irb(main):002:0> require "fcgi"
> => true
> 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.

HTH,
Phill

Dale

1/25/2007 9:21:00 AM

0

Thanks Phill.

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.

Seon

4/22/2010 12:22:00 AM

0



"jane" <jane.playne@gmail.com> wrote in message
news:0d79c692-7395-4590-9a1e-3417d3b788cd@i37g2000yqn.googlegroups.com...
> On Apr 21, 11:55 am, Ramon F Herrera <ra...@conexus.net> wrote:
>> On Apr 21, 5:27 am, "Seon Ferguson" <seo...@gmail.com> wrote:
>>
>> > I dohttp://www.orbwar.com/anti-bush-posters-protest... all of a
>> > sudden it is racist to call a president of the USA a Nazi. I guess to
>> > the
>> > far left it is only bad when it is their president being called a Nazi.
>> > Obama being president has shown me the hypocrisy of the American left.
>> > I dohttp://www.orbwar.com/anti-bush-posters-prot... now all of a
>> > sudden it is racist to call a president of the USA a Nazi. I guess to
>> > the
>> > far left it is only bad when it is their president being called a Nazi.
>> > Obama being president has shown me the hypocrisy of the American left.
>>
>> It is not racist calling Prez Obbie a Nazi, or an idiot, or moron,
>> etc. He knows pretty well what kinds of things to expect: As they say,
>> it goes with the territory.
>>
>> It is racist and offensive calling him a chimp, negro, mulatto, etc.
>>
>> It is acceptable to call Bush a chimp.
>> It is not acceptable to call Obama a chimp.
>>
>> Think about it...
>>
That's double standards and hypocrisy at it's worst.


Seon

4/22/2010 12:23:00 AM

0



"Vandar" <vandar69@yahoo.com> wrote in message
news:hqnfnt$agn$1@news.albasani.net...
> Ramon F Herrera wrote:
>> On Apr 21, 5:27 am, "Seon Ferguson" <seo...@gmail.com> wrote:
>>
>>>I dohttp://www.orbwar.com/anti-bush-posters-prot... now all of a
>>>sudden it is racist to call a president of the USA a Nazi. I guess to the
>>>far left it is only bad when it is their president being called a Nazi.
>>>Obama being president has shown me the hypocrisy of the American left.
>>
>>
>>>I dohttp://www.orbwar.com/anti-bush-posters-prot... now all of a
>>>sudden it is racist to call a president of the USA a Nazi. I guess to the
>>>far left it is only bad when it is their president being called a Nazi.
>>>Obama being president has shown me the hypocrisy of the American left.
>>
>>
>> It is not racist calling Prez Obbie a Nazi, or an idiot, or moron,
>> etc. He knows pretty well what kinds of things to expect: As they say,
>> it goes with the territory.
>>
>> It is racist and offensive calling him a chimp, negro, mulatto, etc.
>>
>> It is acceptable to call Bush a chimp.
>> It is not acceptable to call Obama a chimp.
>>
>> Think about it...
>
> So you think people should be treated differently based on the color of
> their skin.
> Got it.
>
If that isn't hypocrisy I don't know what hypocrisy is.