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

I'm attempting to use two perl modules, BerkeleyDB.pm and MY::Net::SFTP.
However, when attempting to use them in the same package , thus
package mypackage; @ISA = qw (somethingelse); use BerkeleyDB; use MY::Net::SFTP;

Now MY::Net::SFTP uses Net::SFTP. When I attempt to run the simple test
program which follows


#!/usr/local/bin/perl use Net::SFTP; use BerkeleyDB; my %params = ( user => 'myusername' , password => 'mypassword'); my $myaddr = '/home/mine/secure'; my $sftp = eval 'Net::SFPT->new($myaddr,%params)';


this fails with tons of errors with the BerkeleyDB.pm and succeeds without it.
Any ideas, here are the errors:
"makerandom" is not exported by the Crypt::Random module
"makerandom_itv" is not exported by the Crypt::Random module
"makerandom_octet" is not exported by the Crypt::Random module
Can't continue after import errors at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Crypt/Random/Generator.pm line 12 BEGIN failed--compilation aborted at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Crypt/Random/Generator.pm line 12, <GEN2> line 1.
Compilation failed in require at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Crypt/Random.pm line 18, <GEN2> line 1.
BEGIN failed--compilation aborted at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Crypt/Random.pm line 18, <GEN2> line 1.
Compilation failed in require at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Crypt/DH.pm line 6, <GEN2> line 1.
BEGIN failed--compilation aborted at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Crypt/DH.pm line 6, <GEN2> line 1.
Compilation failed in require at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SSH/Perl/Kex/DH1.pm line 13, <GEN2> line 1.
BEGIN failed--compilation aborted at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SSH/Perl/Kex/DH1.pm line 13, <GEN2> line 1.
Compilation failed in require at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SSH/Perl/Kex.pm line 6, <GEN2> line 1.
BEGIN failed--compilation aborted at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SSH/Perl/Kex.pm line 6, <GEN2> line 1.
Compilation failed in require at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SSH/Perl/SSH2.pm line 6, <GEN2> line 1.
BEGIN failed--compilation aborted at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SSH/Perl/SSH2.pm line 6, <GEN2> line 1.
Compilation failed in require at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SSH/Perl.pm line 51, <GEN2> line 1.
or
marge2{mxp:92}% testSFTP
"SSH2" is not exported by the Net::SSH::Perl::Buffer module
Can't continue after import errors at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SFTP/Buffer.pm line 6
BEGIN failed--compilation aborted at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SFTP/Buffer.pm line 6, <CLPFH> line 1.
Compilation failed in require at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SFTP/Attributes.pm line 7, <CLPFH> line 1.
BEGIN failed--compilation aborted at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SFTP/Attributes.pm line 7, <CLPFH> line 1.
Compilation failed in require at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SFTP.pm line 8, <CLPFH> line 1.
BEGIN failed--compilation aborted at /usr/depot/redhat9/perl/5.8.0/lib/site_perl/5.8.0/Net/SFTP.pm line 8, <CLPFH> line 1.
Compilation failed in require at /usr3/mxp/dev/src/KEOF/Operations/SFTP.pm line 2, <CLPFH> line 1.
BEGIN failed--compilation aborted at /usr3/mxp/dev/src/KEOF/Operations/SFTP.pm line 2, <CLPFH> line 1.
Compilation failed in require at /usr3/mxp/dev/src/KEOF/Operations/Data.pm line 829, <CLPFH> line 1.
BEGIN failed--compilation aborted at /usr3/mxp/dev/src/KEOF/Operations/Data.pm line 829, <CLPFH> line 1.
Compilation failed in require at testSFTP line 5, <CLPFH> line 1.
BEGIN failed--compilation aborted at testSFTP line 5, <CLPFH> line 1.

Replies are listed 'Best First'.
Re: Dueling Modules
by jhourcle (Prior) on Jun 24, 2005 at 22:07 UTC

    It'll probably help to change change:

    my $sftp  = eval 'Net::SFPT->new($myaddr,%params)'

    to:

    my $sftp  = eval  { Net::SFTP->new($myaddr,%params) };

    But i think the big errors are:

    "makerandom" is not exported by the Crypt::Random module "makerandom_itv" is not exported by the Crypt::Random module "makerandom_octet" is not exported by the Crypt::Random module

    Which means that something is attempting to use Crypt::Random, but the version that it found doesn't have 'makerandom' and the other functions in @EXPORT or @EXPORT_OK. You may wish to make sure your Crypt::Random is up to date, and not corrupted.

    I'd also suggest adding 'use strict' and 'use warnings', in both your scripts, and in your 'MY::Net::SFTP' module.

Re: Dueling Modules
by cees (Curate) on Jun 25, 2005 at 05:06 UTC

    You are probably hitting this bug in Crypt::Random. It was fixed in the latest version (1.25), so make sure you are using the latest version.

Re: Dueling Modules
by salva (Canon) on Jun 26, 2005 at 09:51 UTC
    If you don't really need to use login/passwd pairs for authentication (using pairs of public and private keys, for instance), give a try to Net::SFTP::Foreign.

    It is a fork of Net::SFTP that uses the native ssh client to stablish the connection to the remote server instead of Net::SSH::Perl, and so it has less dependencies and is more robust.