Forum: Ruby snmp gem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bb118b6226ebc13ac995cb349c43d6c6?d=identicon&s=25 Rohit Mehta (Guest)
on 2006-05-05 17:25
(Received via mailing list)
Hi I am trying to use the snmp gem, and it doesn't seem to work.
I am not sure what is wrong.  "gem install snmp" seems to report
success.

"gem list" contains the following

snmp (1.0.1)
    A Ruby implementation of SNMP (the Simple Network Management
    Protocol).

So it looks like it installed correctly.  However just issuing the
following in irb
shows me something is wrong:

irb(main):001:0> require 'snmp'
LoadError: no such file to load -- snmp
        from (irb):1:in `require'
        from (irb):1
irb(main):002:0>

I am using "ruby 1.8.4 (2005-12-24) [i686-linux]" compiled from source.
I have installed
other gems with no problems at all.

Does anyone have any idea what I am doing wrong?  Thanks in advance!

Rohit
Cb48ca5059faf7409a5ab3745a964696?d=identicon&s=25 unknown (Guest)
on 2006-05-05 17:31
(Received via mailing list)
On Sat, 6 May 2006, Rohit Mehta wrote:

> So it looks like it installed correctly.  However just issuing the following
> have installed
> other gems with no problems at all.
> Does anyone have any idea what I am doing wrong?  Thanks in advance!
>
> Rohit

require 'rubygems'

-a
Bb118b6226ebc13ac995cb349c43d6c6?d=identicon&s=25 Rohit Mehta (Guest)
on 2006-05-05 18:11
(Received via mailing list)
ara.t.howard@noaa.gov wrote:

> require 'rubygems'


Thanks Ara!  Typing "SNMP.methods" in irb seems to give
me good output now.

Do you know why the docs say

require 'snmp'

Should it instead say

require 'rubygems'
require_gem 'snmp'

One last question. If I installed from a tarball instead of using gem,
would
require 'snmp' work?

Please forgive my newbyish questions!  I am only an egg! Someday a
skilled
ruby programmer will hatch!  Thanks!

Rohit
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-05-05 18:33
(Received via mailing list)
On May 5, 2006, at 12:09 PM, Rohit Mehta wrote:

> require_gem 'snmp'
>

If the docs were to change, it should be to the following, not what
you have above
require 'rubygems'
require 'snmp'

require_gem only invokes #require if the gem as an autorequire
attribute. The autorequire mechanism is being deprecated though, and
the name of require_gem will probably change to reduce confusion. You
should only use require_gem to choose a specific version
e.g.
require 'rubygems'
require_gem 'some_gem', '1.0' # when I require 'some_gem' I want
version 1.0
require 'some_gem' # actually load the code for 'some_gem'


> One last question. If I installed from a tarball instead of using
> gem, would
> require 'snmp' work?
>

Probably yes.
Cb48ca5059faf7409a5ab3745a964696?d=identicon&s=25 unknown (Guest)
on 2006-05-05 18:45
(Received via mailing list)
On Sat, 6 May 2006, Rohit Mehta wrote:

> require 'snmp'
>
> Should it instead say
>
> require 'rubygems'
> require_gem 'snmp'

nope.  this is the 'fault' of rubygems and has nothing to do with snmp.
all
libs suffer this fate under rubygems but it's very well covered under
the
rubygems docs.

>
> One last question. If I installed from a tarball instead of using gem, would
> require 'snmp' work?

exactly.

> Please forgive my newbyish questions!  I am only an egg! Someday a skilled
> ruby programmer will hatch!  Thanks!

careful - you'll get egg on your face ;-)

cheers.

-a
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (Guest)
on 2006-05-05 19:13
(Received via mailing list)
On 5/5/06, Rohit Mehta <ro@paper-mill.com> wrote:
>
> Should it instead say
>
> require 'rubygems'
> require_gem 'snmp'

No. You want
  require 'rubygems'
  require 'snmp'

DO NOT USE require_gem.

Forget that it ever existed.

> One last question. If I installed from a tarball instead of using gem,
> would
> require 'snmp' work?

Yes. But that's only because require 'rubygems' modifies #require to
work with where Gems are installed.

-austin
This topic is locked and can not be replied to.