Using Tk with Net::SFTP 
Author Message
 Using Tk with Net::SFTP

I can't seem to get Tk and Net::SFTP to play nicely together - if I 'use' both
in the same program I get a number of errors. The problem can be demonstrated
with this minimal program:

#!/usr/bin/perl
use strict;
use warnings;

use Net::SFTP;
use Tk;

my $sftp = Net::SFTP->new('localhost');

__END__

"makerandom" is not exported by the Crypt::Random module at
/usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm line 12
"makerandom_itv" is not exported by the Crypt::Random module at
/usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm line 12
"makerandom_octet" is not exported by the Crypt::Random module at
/usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm line 12 Can't continue
after import errors at /usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm
line 12 BEGIN failed--compilation aborted at
/usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm line 12, <GEN0> line
1.
...

If I reverse the order of the modules so that Tk is used first, I get:

"SSH2" is not exported by the Net::SSH::Perl::Buffer module at
/usr/lib/perl5/site_perl/5.6.1/Net/SFTP/Buffer.pm line 6 Can't continue after
import errors at /usr/lib/perl5/site_perl/5.6.1/Net/SFTP/Buffer.pm line 6 BEGIN
failed--compilation aborted at
/usr/lib/perl5/site_perl/5.6.1/Net/SFTP/Buffer.pm line 6.  Compilation failed
in require at /usr/lib/perl5/site_perl/5.6.1/Net/SFTP/Attributes.pm line 7.
...

I'm using:
    Tk:        800.024
    Net::SFTP: 0.05
    Perl:      5.6.1
    O/S:       Linux

How can I get these modules to work together?

Cheers,
Dave.
--
dave.weaver(at)zen.co.uk



Mon, 19 Sep 2005 18:05:18 GMT  
 Using Tk with Net::SFTP


Quote:
> I can't seem to get Tk and Net::SFTP to play nicely together - if I 'use'
both
> in the same program I get a number of errors. The problem can be
demonstrated
> with this minimal program:

> #!/usr/bin/perl
> use strict;
> use warnings;

> use Net::SFTP;
> use Tk;

> my $sftp = Net::SFTP->new('localhost');

> __END__

> "makerandom" is not exported by the Crypt::Random module at
> /usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm line 12
> "makerandom_itv" is not exported by the Crypt::Random module at
> /usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm line 12
> "makerandom_octet" is not exported by the Crypt::Random module at
> /usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm line 12 Can't
continue
> after import errors at

/usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm

- Show quoted text -

Quote:
> line 12 BEGIN failed--compilation aborted at
> /usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm line 12, <GEN0>
line
> 1.
> ...

> If I reverse the order of the modules so that Tk is used first, I get:

> "SSH2" is not exported by the Net::SSH::Perl::Buffer module at
> /usr/lib/perl5/site_perl/5.6.1/Net/SFTP/Buffer.pm line 6 Can't continue
after
> import errors at /usr/lib/perl5/site_perl/5.6.1/Net/SFTP/Buffer.pm line 6
BEGIN
> failed--compilation aborted at
> /usr/lib/perl5/site_perl/5.6.1/Net/SFTP/Buffer.pm line 6.  Compilation
failed
> in require at /usr/lib/perl5/site_perl/5.6.1/Net/SFTP/Attributes.pm line
7.
> ...

> I'm using:
>     Tk:        800.024
>     Net::SFTP: 0.05
>     Perl:      5.6.1
>     O/S:       Linux

> How can I get these modules to work together?

> Cheers,
> Dave.

Doesn't make any sense at all to me :-)

What happens with that minimal script if you delete 'use Tk;' ? I can't see
how using or not using Tk would make any difference.

Given that you get those errors, then
 'use Crypt::Random::Generator;' should be enough to produce the first set
of errors, and
'use Net::SSH::Perl::Buffer;' should produce the second set.
Is that so ?

Cheers,
Rob



Tue, 20 Sep 2005 19:58:35 GMT  
 Using Tk with Net::SFTP

Quote:



> > I can't seem to get Tk and Net::SFTP to play nicely together - if I 'use'
> > both in the same program I get a number of errors. The problem can be
> > demonstrated with this minimal program:

> > #!/usr/bin/perl
> > use strict;
> > use warnings;

> > use Net::SFTP;
> > use Tk;

> > my $sftp = Net::SFTP->new('localhost');

> > __END__

> > "makerandom" is not exported by the Crypt::Random module at
> > /usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm line 12
--<snip>--

>  Doesn't make any sense at all to me :-)

>  What happens with that minimal script if you delete 'use Tk;' ? I can't see
>  how using or not using Tk would make any difference.

Works fine without Tk.

Quote:
>  Given that you get those errors, then
>   'use Crypt::Random::Generator;' should be enough to produce the first set
>  of errors, and
>  'use Net::SSH::Perl::Buffer;' should produce the second set.
>  Is that so ?

I don't understand what you're suggesting; use the above instead of what?
I need the "use Net::SFTP" line, otherwise the error isn't generated (since
it's generated at run-time in the call to Net::SFTP->new()). And if I remove
the "use Tk" line then the error goes away anyay.

Anyway, I've found a work-around; I just "require Tk;" instead, then make sure
I fully qualify the few Tk calls I need (only Tk::MainWindow and Tk::MainLoop
as it happens, so it's a fairly trivial fix).

Cheers,
Dave.



Fri, 23 Sep 2005 15:34:55 GMT  
 Using Tk with Net::SFTP

Quote:

> I don't understand what you're suggesting; use the above instead of what?
> I need the "use Net::SFTP" line, otherwise the error isn't generated (since
> it's generated at run-time in the call to Net::SFTP->new()). And if I remove
> the "use Tk" line then the error goes away anyay.

> Anyway, I've found a work-around; I just "require Tk;" instead, then make sure
> I fully qualify the few Tk calls I need (only Tk::MainWindow and Tk::MainLoop
> as it happens, so it's a fairly trivial fix).

> Cheers,
> Dave.

It sounds to me like a function name conflict. Tk might be exporting
something by default into the namespace that is conflicting with the
functions used in the other modules. Yet another reason to NEVER export
by default.

You might want to drop an email to the Tk maintainer and tell him about
the problem. If there is a conflict, he'd probably be interested in it.

Pete



Sat, 24 Sep 2005 05:44:30 GMT  
 Using Tk with Net::SFTP


Quote:




> > > I can't seem to get Tk and Net::SFTP to play nicely together - if I
'use'
> > > both in the same program I get a number of errors. The problem can be
> > > demonstrated with this minimal program:

> > > #!/usr/bin/perl
> > > use strict;
> > > use warnings;

> > > use Net::SFTP;
> > > use Tk;

> > > my $sftp = Net::SFTP->new('localhost');

> > > __END__

> > > "makerandom" is not exported by the Crypt::Random module at
> > > /usr/lib/perl5/site_perl/5.6.1/Crypt/Random/Generator.pm line 12
> --<snip>--

> >  Doesn't make any sense at all to me :-)

> >  What happens with that minimal script if you delete 'use Tk;' ? I can't
see
> >  how using or not using Tk would make any difference.

> Works fine without Tk.

No doubt there's a good reason for that. I haven't got a clue what that
"good reason" could possibly be.

What could possibly make perl state that the functions "makerandom", etc.
are not exported by Crypt::Random, when, in fact they are ?? At least
they're exported on request .... and line 12 of Crypt::Random::Generator
makes precisely *that* request.

What I was suggesting was that you should get the same errors by running a
script that contains simply:
use Crypt::Random::Generator;

But, obviously, that's not the case, either.

Anyway, you've found a solution .... just be thankful for that, I guess :-)

Cheers,
Rob



Sat, 24 Sep 2005 20:27:57 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Failed connection to sftp server via Net::SFTP

2. Net::SFTP Fails, sftp OK

3. Net::SFTP vs. Net::SSH::Perl

4. Windows to Unix Net::SCP or SFTP, public key authentication question

5. Exiting a Net::SFTP connection

6. Net::SFTP error trapping

7. Net::SFTP login

8. Net::SFTP and aix

9. Net::SFTP - "ssh port mapping" problem

10. Net::SFTP problem

11. Exiting a Net::SFTP connection

12. Net::SFTP fails when uploading to Solaris

 

 
Powered by phpBB® Forum Software