zajaco0 has asked for the wisdom of the Perl Monks concerning the following question:

I am running perl 5.6.1, bastille linux, and RH 7.3. I'm having trouble using a perl module. I try to load it using the test.pl file

the test.pl file
#!/usr/bin/perl BEGIN{ require "/home/neteng/RRDs.pm"; eval('"/home/neteng/RRDs.pm"->import()'); } #use lib qw(/home/neteng/RRDs.pm); <---I have also tried this #use RRDs <--and this

permissions of module

[neteng@netflow neteng]$ ll RRDs.pm -r--r--r-- 1 neteng neteng 3514 Oct 22 13:39 RRDs.pm
[neteng@netflow neteng]$ perl -c test.pl Can't locate loadable object for module RRDs in @INC (@INC contains: / +usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/si +te_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl +5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/ +perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux /usr/lib/ +perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl .) at test.pl line + 6 Compilation failed in require at test.pl line 6. BEGIN failed--compilation aborted at test.pl line 8.

Ran as root:

[root@netflow neteng]# perl -c test.pl test.pl syntax OK

it's not the fact that it's not finding the module. I have had that error before....it says Cannot locate file RRDs.pm. This is actually a different error, where it says "Cannot locate loadable module" I think it has something to do with bastille linux. not letting non-root users load modules.

ive spent about 20+ hrs on this problem, im about ready to reformat and not use bastille.

~Zach

Replies are listed 'Best First'.
Re: module problems
by bobf (Monsignor) on Oct 22, 2004 at 18:48 UTC

    Try this:

    use lib '/home/neteng'; # use RRDs; # do this, or the eval statement (to check success/fail) eval "require RRDs"; if( $@ ){ print "RRDs is not installed\n"; }

    See also use and perlfaq8 (What's the difference between require and use? How do I keep my own module/library directory? How do I add the directory my program lives in to the module/library search path? How do I add a directory to my include path at runtime? ).

    HTH

    Update: For what it's worth, the module couldn't be found because (as you point out) it wasn't in @INC. First add the directory for the module to @INC with use lib, then use or require it (don't include the '.pm' when using or requiring a module, and don't include the module name in a use lib statement). Oh, and use warnings; use strict;.

Re: module problems
by tachyon (Chancellor) on Oct 22, 2004 at 23:52 UTC

    You have copied and pasted the .pm module without the associated binary files. To do a complete local install of rrdtool you would:

    $ wget http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/rrdtool. +tar.gz $ tar xzf rrdtool.tar.gz $ cd rrdtool-1.0.49/ $ sh configure --prefix=/home/neteng/rrdtool $ make && make install $ cd /home/neteng $ cat test.pl #!/usr/bin/perl use lib '/home/neteng/rrdtool/lib/perl'; use RRDs; print $RRDs::VERSION, $/; $ ./test.pl 1.000491

    cheers

    tachyon

Re: module problems
by chromatic (Archbishop) on Oct 22, 2004 at 20:55 UTC

    This error comes from DynaLoader when it can't load the compiled portion of an XS module. It sounds like the installation of the RRDs module failed somehow. Did you copy the .pm file from elsewhere?