http://qs1969.pair.com?node_id=316856

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

Wow, I am befuddled. Here's a minimal case demonstrating the problem. The follow code runs fine
use strict; use Data::Dumper; use Net::SSH::W32Perl; use Net::SFTP; use Memoize; my $host = 'xxxxxx'; my $user = 'xxxxx'; my $password = 'xxxxxx'; my $sftp = Net::SFTP->new( $host, user => $user, password => $password, debug => 0, protocol => 2 );
But if I use GetOpt::Declare,
use strict; use Data::Dumper; use Net::SSH::W32Perl; use Net::SFTP; use Memoize; use GetOpt::Declare; my $host = 'xxxxxx'; my $user = 'xxxxx'; my $password = 'xxxxxx'; my $sftp = Net::SFTP->new( $host, user => $user, password => $password, debug => 0, protocol => 2 );
all hell breaks loose and I get heaps of complaints
C:\TWO\scratch>perl sftp.pl "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 C:/APPS/Perl/site/lib/Crypt/Rand +om/Generator.pm line 12 BEGIN failed--compilation aborted at C:/APPS/Perl/site/lib/Crypt/Rando +m/Generator.pm line 12, <GEN0> line 1. Compilation failed in require at C:/APPS/Perl/site/lib/Crypt/Random.pm + line 18, <GEN0> line 1. BEGIN failed--compilation aborted at C:/APPS/Perl/site/lib/Crypt/Rando +m.pm line 18, <GEN0> line 1. Compilation failed in require at C:/APPS/Perl/site/lib/Crypt/DH.pm lin +e 6, <GEN0> line 1. BEGIN failed--compilation aborted at C:/APPS/Perl/site/lib/Crypt/DH.pm + line 6, <GEN0> line 1. Compilation failed in require at C:/APPS/Perl/site/lib/Net/SSH/Perl/Ke +x/DH1.pm line 13, <GEN0> line 1. BEGIN failed--compilation aborted at C:/APPS/Perl/site/lib/Net/SSH/Per +l/Kex/DH1.pm line 13, <GEN0> l ine 1. Compilation failed in require at C:/APPS/Perl/site/lib/Net/SSH/Perl/Ke +x.pm line 6, <GEN0> line 1. BEGIN failed--compilation aborted at C:/APPS/Perl/site/lib/Net/SSH/Per +l/Kex.pm line 6, <GEN0> line 1 . Compilation failed in require at C:/APPS/Perl/site/lib/Net/SSH/Perl/SS +H2.pm line 6, <GEN0> line 1. BEGIN failed--compilation aborted at C:/APPS/Perl/site/lib/Net/SSH/Per +l/SSH2.pm line 6, <GEN0> line 1. Compilation failed in require at C:/APPS/Perl/site/lib/Net/SSH/W32Perl +/SSH2.pm line 7, <GEN0> line 1 . BEGIN failed--compilation aborted at C:/APPS/Perl/site/lib/Net/SSH/W32 +Perl/SSH2.pm line 7, <GEN0> li ne 1. Compilation failed in require at C:/APPS/Perl/site/lib/Net/SSH/Perl.pm + line 55, <GEN0> line 1. C:\TWO\scratch>
Never seen behavior like this before... how or why is GetOpt::Declare upsetting Net::SFTP?

???

rkg

Replies are listed 'Best First'.
Re: Net::SFTP name space conflict with GetOpt::Declare?
by bl0rf (Pilgrim) on Dec 25, 2003 at 01:40 UTC
    I looked at the source for the above modules and GetOpt is actually upsetting Crypt::Random::Generator and not letting it export subroutines.

    I won't lie, I don't really know what you should do but I suggest doing a require GetOpt::Declare; instead of useing it...
    Its a long shot but I guess its better than nothing:-)
    Good luck.