Lance Kinley, the author of the 2.x features, just sent me a patched Buffer.pm which should make Net::SFTP work again as it depended on Net::SSH::Perl using Math::Pari which in turn is no longer necessary for Net::SSH::Perl.
So if you actually need Net::SFTP to work again, then please try if the attached "Buffer.pm" solves your problem.
In the meantime, Lance tries to send the fix to Net::SFTP...
Kind regards,
Steffen
On Tue Apr 18 11:50:03 2017, SCHWIGON wrote:
Show quoted text> I don't know by myself, but let me ask around...
>
> Kind regards,
> Steffen
>
> On Thu Apr 06 00:55:53 2017, adrian.koszorus@nokia.com wrote:
> > Hello,
> > I have noticed that Net::SSH::perl 2.09.01 doesn't deliver
> > Net::SSH::Perl::Util::SSH2MP anymore.
> > Why?
> > Net::SFTP::Buffer still calls bin2mp ...
> >
> > Undefined subroutine &Net::SFTP::Buffer::bin2mp called at
> > /opt/perl_32/lib/site_perl/5.8.8/Net/SFTP/Buffer.pm line 19.
> >
> > I do have Perl scripts that are using this ... It will cost me a lot
> > to change this now and I can't afford ...
> > And I need Net::SSH::Perl 2.09 ...
> >
> > Thank you for an answer.
> > Regards,
> > Adrian K.
>
--
Steffen Schwigon <ss5@renormalist.net>
Dresden Perl Mongers <
http://dresden-pm.org/>
# $Id: Buffer.pm,v 1.12 2005/01/16 21:36:56 dbrobins Exp $
package Net::SFTP::Buffer;
use strict;
use Net::SSH::Perl::Buffer;
use base qw( Net::SSH::Perl::Buffer );
use Math::Pari qw ( PARI pari2num );
sub new {
return shift->SUPER::new(@_, MP => 'SSH2');
}
sub get_int64 {
my $buf = shift;
my $off = defined $_[0] ? shift : $buf->{offset};
$buf->{offset} += 8;
bin2mp( $buf->bytes($off, 8) );
}
sub put_int64 {
my $buf = shift;
$buf->{buf} .= mp2bin($_[0], 8);
}
sub get_attributes {
my $buf = shift;
Net::SFTP::Attributes->new(Buffer => $buf);
}
sub put_attributes {
my $buf = shift;
$buf->{buf} .= $_[0]->as_buffer->bytes;
}
sub bin2mp {
my $s = shift;
my $p = PARI(0);
my $base = PARI(256);
for my $b (split //, $s) {
$p = $p * $base + ord $b;
}
$p;
}
sub mp2bin {
my($p, $l) = @_;
$l ||= 0;
my $base = PARI(256);
my $res = '';
{
my $r = $p % $base;
my $d = PARI($p-$r) / $base;
$res = chr($r) . $res;
if ($d >= $base) {
$p = $d;
redo;
}
elsif ($d != 0) {
$res = chr($d) . $res;
}
}
$res = "\0" x ($l-length($res)) . $res
if length($res) < $l;
$res;
}
1;
__END__
=head1 NAME
Net::SFTP::Buffer - Read/write buffer class
=head1 SYNOPSIS
use Net::SFTP::Buffer;
my $buffer = Net::SFTP::Buffer->new;
=head1 DESCRIPTION
I<Net::SFTP::Buffer> inherits from I<Net::SSH::Perl::Buffer> to
provide read/write buffer functionality for SSH. SFTP buffers
are exactly the same as SSH buffers, with a couple of additions:
=over 4
=item * 64-bit integers
SFTP requires the use of 64-bit integers to represent very
large file sizes. In I<Net::SFTP::Buffer> 64-bit integers
are implemented as I<Math::Pari> objects.
=item * File attribute bundles
Attribute bundles are not strictly a simple data type--they are,
in fact, made up of smaller pieces, like 32-bit integers, 64-bit
integers, etc.--but for matters of convenience, it is easiest
to provide methods to directly serialize/deserialize attributes
from buffers.
=back
=head1 USAGE
Usage of I<Net::SFTP::Buffer> objects is exactly the same as
usage of I<Net::SSH::Perl::Buffer> objects, with additions of
the following methods to support the above data types.
=head2 $buffer->get_int64
Extracts a 64-bit integer from I<$buffer> and returns it as
a I<Math::Pari> object.
=head2 $buffer->put_int64($int)
Serializes a 64-bit integer I<$int> into the buffer I<$buffer>;
I<$int> can be either a I<Math::Pari> object or a built-in
Perl integer, if it is small enough to fit into a Perl int.
=head2 $buffer->get_attributes
Uses I<Net::SFTP::Attributes> to extract a list of file
attributes from I<$buffer>, and returns a I<Net::SFTP::Attributes>
object containing those file attributes.
=head2 $buffer->put_attributes($attrs)
Serializes a I<Net::SFTP::Attributes> object I<$attrs> into
the buffer I<$buffer>.
=head1 AUTHOR & COPYRIGHTS
Please see the Net::SFTP manpage for author, copyright, and
license information.
=cut