Snmp gem


#1

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


#2

On Sat, 6 May 2006, Rohit M. 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


#3

On May 5, 2006, at 12:09 PM, Rohit M. 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.


#4

removed_email_address@domain.invalid 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


#5

On 5/5/06, Rohit M. removed_email_address@domain.invalid 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


#6

On Sat, 6 May 2006, Rohit M. 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 :wink:

cheers.

-a