Difference between revisions of "Which Perl module should I use"

From Net-SNMP Wiki
Jump to: navigation, search
 
(created)
Line 13: Line 13:
 
these two packages.
 
these two packages.
  
  You shouldn't install Net::SNMP because the SNMP::Info
+
You shouldn't install Net::SNMP because the SNMP::Info
 
module is not written to use the Net::SNMP api.  It's the wrong
 
module is not written to use the Net::SNMP api.  It's the wrong
 
package for this module, so there's no point in installing it.
 
package for this module, so there's no point in installing it.
  
  You *should* install SNMP/Net-SNMP - but not from CPAN.
+
You *should* install SNMP/Net-SNMP - but not from CPAN.
 
Because these modules are closely linked with the C library,
 
Because these modules are closely linked with the C library,
 
they rely on having the correct version of the library installed.
 
they rely on having the correct version of the library installed.
Line 24: Line 24:
 
but can break the perl internals.
 
but can break the perl internals.
  
  The safest approach is to install the SNMP perl modules from
+
The safest approach is to install the SNMP perl modules from
 
the same Net-SNMP distribution as the C libraries that you are
 
the same Net-SNMP distribution as the C libraries that you are
 
using.  That's the most reliable way to ensure compatibility.
 
using.  That's the most reliable way to ensure compatibility.

Revision as of 18:38, 23 January 2008

There are basically two alternative SNMP perl modules. One is a "pure-perl" implementation, called "Net::SNMP" and develeped by David Town. The other is a perl interface to the Net-SNMP C libraries, which comes as two separate packages - SNMP and Net-SNMP. These are therefore closely linked with the C library code.

The SNMP::Info module is a higher-level convenience module, using the Net-SNMP perl modules (i.e. SNMP/Net-SNMP).

The SNMP::Info documentation tells you not to install SNMP or Net::SNMP from CPAN - but the reasons are different for each of these two packages.

You shouldn't install Net::SNMP because the SNMP::Info module is not written to use the Net::SNMP api. It's the wrong package for this module, so there's no point in installing it.

You *should* install SNMP/Net-SNMP - but not from CPAN. Because these modules are closely linked with the C library, they rely on having the correct version of the library installed. There can be minor changes to the library internals from one release to another, which wouldn't affect most applications but can break the perl internals.

The safest approach is to install the SNMP perl modules from the same Net-SNMP distribution as the C libraries that you are using. That's the most reliable way to ensure compatibility.

If you are using a vendor-supplied version of the Net-SNMP suite, then they ought to provide a package that includes the perl APIs as well. If you compiled things yourself from source, then

./configure --with-perl-modules

will build the correct perl API modules as well.