Newbie Perl Module Problem

Darren Munday dazzer at beerdrinkers.co.uk
Wed Oct 26 12:54:07 UTC 2005


Hi All,

I'm having a problem running a Perl script (written by my colleague)
which uses the module Net::SNMP 

The module is installed but I'm suspecting for some reason it's not in
the correct location. My colleague installed the module and ran the
script using Debian with no problems but replicating it on Ubuntu is
problematic.

Any ideas would be greatly received,

Thanks in advance,

Darren. :0)
=======================
Here's the first section of the script:
=======================
#!/usr/bin/perl

use strict;
use Net::SNMP;
use DBI;
use DBD::Pg qw(:pg_types);

my $community_string = "innovcom";
my $version = "2";
my $counter = 0;
my $ifOperStatus = ".1.3.6.1.2.1.2.2.1.8";
my $ifInOctets = ".1.3.6.1.2.1.2.2.1.10";
my $host = "144.32.82.28";
my $port;
my @ports;
my %portcounters;

# Initialise "session" object with ip address and community string
my ($session, $error) = Net::SNMP->session(
					       Hostname => $host,
					       Community => $community_string,
					       Version => $version
					       );
die "Initialise session error: $error" unless ($session);
=======================
Here's the error:
=======================
Can't locate Net/SNMP.pm in @INC (@INC contains: 
/etc/perl 
/usr/local/lib/perl/5.8.7 
/usr/local/share/perl/5.8.7 
/usr/lib/perl5 
/usr/share/perl5 
/usr/lib/perl/5.8 
/usr/share/perl/5.8 
/usr/local/lib/site_perl .) at ./innov3.pl line 4.
BEGIN failed--compilation aborted at ./innov3.pl line 4.
========================
Here's a suggestion for a solution to a similar problem I found through
Google which uses a sym link. As with this problem, the "Net" directory
doesn't exist on my install either:
========================
On Thu, 18 Sep 2003, Mike McClure wrote:
 >
 >> SNMP.pm does not appear to be in the correct place.  How did you install it?
 >>
 >> Anyway, this should fix your problem:
 >>
 >> cd /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
 >> mkdir Net
 >> cd Net
 >> ln -s ../SNMP.pm .
 >>
========================
The resulting error from following the suggestion above:
========================
Can't locate object method "session" via package "Net::SNMP" (perhaps
you forgot to load "Net: :SNMP"?) at ./innov3.pl line 19.
========================







More information about the ubuntu-users mailing list