diff -Nru libnet-ssh2-perl-0.56/Changes libnet-ssh2-perl-0.58/Changes --- libnet-ssh2-perl-0.56/Changes 2015-10-09 14:04:26.000000000 +0000 +++ libnet-ssh2-perl-0.58/Changes 2015-12-20 07:49:42.000000000 +0000 @@ -1,5 +1,21 @@ Revision history for Perl extension Net::SSH2. +0.58 2015-12-20 + - rereleas as stable + +0.57_03 2015-12-5 + - remove MYMETA.* from distribution (fixes #rt108717, reported + by Alexandr Ciornii) + - workaround bug in libssh2_agent_disconnect (fixes #28, + reported by Tore Anderson) + +0.57_02 2015-10-29 + - Module::Install::CheckLib was missing + +0.57_01 2015-10-26 + - reimplement scp_put and scp_get methods fixing several issues + - add support for Mac Homebrew and its keg-only OpenSSL + 0.56 2015-10-9 - add support for auth_publickey_frommemory method (patch by Adam Osuchowski) diff -Nru libnet-ssh2-perl-0.56/debian/changelog libnet-ssh2-perl-0.58/debian/changelog --- libnet-ssh2-perl-0.56/debian/changelog 2015-10-25 14:46:22.000000000 +0000 +++ libnet-ssh2-perl-0.58/debian/changelog 2016-01-02 12:31:01.000000000 +0000 @@ -1,3 +1,23 @@ +libnet-ssh2-perl (0.58-3) unstable; urgency=medium + + * Upload to unstable + + -- Salvatore Bonaccorso Sat, 02 Jan 2016 13:29:57 +0100 + +libnet-ssh2-perl (0.58-2) experimental; urgency=medium + + * Fix installation of additional examples + * Fix interpreter shebang lines in example files to use /usr/bin/perl + + -- Salvatore Bonaccorso Sun, 20 Dec 2015 16:59:54 +0100 + +libnet-ssh2-perl (0.58-1) experimental; urgency=medium + + * Import upstream version 0.58 + * Add more examples files to docs from distribution + + -- Salvatore Bonaccorso Sun, 20 Dec 2015 13:54:06 +0100 + libnet-ssh2-perl (0.56-1) unstable; urgency=medium * Import upstream version 0.56 @@ -205,12 +225,12 @@ * New upstream release * Refresh debian/copyright to the revision 135 of format specification for - machine readable copyright file in DEP5 and update copyright years. + machine readable copyright file in DEP5 and update copyright years. * Convert to '3.0 (quilt)' package source format. Drop README.source and adjust debian/control to not use the --with quilt framework. Drop quilt from Build-Depends and lower Build-Depends on debhelper (>= 7). - * Bump Standards-Version to 3.8.4 (no changes). - * Refresh debian/patches. + * Bump Standards-Version to 3.8.4 (no changes). + * Refresh debian/patches. -- Salvatore Bonaccorso Thu, 15 Apr 2010 08:20:50 +0200 @@ -256,9 +276,9 @@ [ Salvatore Bonaccorso ] * New upstream release * debian/control: Add myself to Uploaders - * debian/copyright: Update copyright for debian/* packaging - * debian/patches: Refresh the fix-build patch and add patch - header. + * debian/copyright: Update copyright for debian/* packaging + * debian/patches: Refresh the fix-build patch and add patch + header. [ gregor herrmann ] * Add perl to Build-Depends. diff -Nru libnet-ssh2-perl-0.56/debian/libnet-ssh2-perl.examples libnet-ssh2-perl-0.58/debian/libnet-ssh2-perl.examples --- libnet-ssh2-perl-0.56/debian/libnet-ssh2-perl.examples 2015-10-25 14:46:22.000000000 +0000 +++ libnet-ssh2-perl-0.58/debian/libnet-ssh2-perl.examples 2016-01-02 12:31:01.000000000 +0000 @@ -1 +1,2 @@ debian/example.pl +example/* diff -Nru libnet-ssh2-perl-0.56/debian/rules libnet-ssh2-perl-0.58/debian/rules --- libnet-ssh2-perl-0.56/debian/rules 2015-10-25 14:46:22.000000000 +0000 +++ libnet-ssh2-perl-0.58/debian/rules 2016-01-02 12:31:01.000000000 +0000 @@ -1,7 +1,14 @@ #!/usr/bin/make -f +PACKAGE = $(shell dh_listpackages) +TMP = $(CURDIR)/debian/$(PACKAGE) + %: dh $@ override_dh_auto_configure: dh_auto_configure -- gcrypt + +override_dh_installexamples: + dh_installexamples + sed -i '1s|^#!perl|#!/usr/bin/perl|' $(TMP)/usr/share/doc/$(PACKAGE)/examples/* diff -Nru libnet-ssh2-perl-0.56/example/rt58911.pl libnet-ssh2-perl-0.58/example/rt58911.pl --- libnet-ssh2-perl-0.56/example/rt58911.pl 1970-01-01 00:00:00.000000000 +0000 +++ libnet-ssh2-perl-0.58/example/rt58911.pl 2015-09-28 20:14:43.000000000 +0000 @@ -0,0 +1,33 @@ +#!/usr/bin/perl -W + +use strict; +use Fcntl; +use warnings FATAL => qw (all); +use Getopt::Std; +use Net::SSH2; +use 5.010; + +my %opts = (h => 'localhost'); +getopts('h:u:p:', \%opts); +my ($hostname, $user, $password) = @opts{qw(h u p)}; +my $fn = shift // die "filename argument missing"; + +my $ssh2 = Net::SSH2->new(); +sub ssh2_die { die join(': ', @_, join('|', $ssh2->error)) } +$ssh2->debug(1); + +$ssh2->connect($hostname) + or ssh2_die("connect failed");; + +$ssh2->auth(username => $user, password => $password) + or ssh2_die('auth failed'); + +my $sftp = $ssh2->sftp() + or ssh2_die("sftp failed"); + +my $remote = $sftp->open($fn, O_WRONLY | O_CREAT | O_TRUNC); + +my $str = 'A' x 327480; +my $bytes = print $remote $str; +say "print returned $bytes, expected " . length($str); + diff -Nru libnet-ssh2-perl-0.56/example/rt80011.pl libnet-ssh2-perl-0.58/example/rt80011.pl --- libnet-ssh2-perl-0.56/example/rt80011.pl 1970-01-01 00:00:00.000000000 +0000 +++ libnet-ssh2-perl-0.58/example/rt80011.pl 2015-09-28 20:55:32.000000000 +0000 @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Net::SSH2; +use Getopt::Std; +use IO::Scalar; +use 5.010; + +my %opts = (h => 'localhost'); +getopts('h:u:p:', \%opts); +my ($hostname, $user, $password) = @opts{qw(h u p)}; + +my $fn = shift // die "filename argument missing"; + +sub ssh2_die { + my $ssh2 = shift; + die join(': ', @_, join('|', $ssh2->error)); +} + + +my $ssh2 = Net::SSH2->new(); +$ssh2->connect($hostname) or ssh2_die($ssh2, "Unable to connect to host $hostname"); +$ssh2->auth(username => $user, password => $password) or ssh2_die($ssh2, "Authentication failed"); + +my $chan = $ssh2->channel(); +my $output = IO::Scalar->new; +$ssh2->scp_get($fn, $output) or ssh2_die($ssh2, "SCP failed"); +my $lines = $output =~ tr/\n/\n/; +say "Number of lines in remote file: $lines\n"; +$chan->close; +$ssh2->disconnect(); diff -Nru libnet-ssh2-perl-0.56/lib/Net/SSH2.pm libnet-ssh2-perl-0.58/lib/Net/SSH2.pm --- libnet-ssh2-perl-0.56/lib/Net/SSH2.pm 2015-10-09 14:04:58.000000000 +0000 +++ libnet-ssh2-perl-0.58/lib/Net/SSH2.pm 2015-12-20 07:49:50.000000000 +0000 @@ -1,6 +1,6 @@ package Net::SSH2; -our $VERSION = '0.56'; +our $VERSION = '0.58'; use 5.006; use strict; @@ -13,6 +13,7 @@ use Socket; use IO::File; use File::Basename; +use Errno; use base 'Exporter'; @@ -429,38 +430,50 @@ $path = basename $remote if not defined $path; my %stat; - my $chan = $self->_scp_get($remote, \%stat); - return unless $chan; + $self->blocking(1); + my $chan = $self->_scp_get($remote, \%stat) or return; # read and commit blocks until we're finished - $chan->blocking(1); - my $mode = $stat{mode} & 0777; my $file; if (ref $path) { $file = $path; } else { + my $mode = $stat{mode} & 0777; $file = IO::File->new($path, O_WRONLY | O_CREAT | O_TRUNC, $mode); - return unless $file; + unless ($file) { + $self->_set_error(LIBSSH2_ERROR_FILE(), "Unable to open local file: $!"); + return; + } binmode $file; } - for (my ($size, $count) = ($stat{size}); $size > 0; $size -= $count) { - my $buf = ''; - my $block = ($size > 8192) ? 8192 : $size; - $count = $chan->read($buf, $block); - return unless defined $count; - $self->error(0, "read $block bytes but only got $count"), return - unless $count == $block; - $self->error(0, "error writing $count bytes to file"), return - unless $file->syswrite($buf, $count) == $count; + my $size = $stat{size}; + while ($size > 0) { + my $bytes_read = $chan->read(my($buf), (($size > 40000 ? 40000 : $size))); + if ($bytes_read) { + $size -= $bytes_read; + while (length $buf) { + my $bytes_written = $file->syswrite($buf, length $buf); + if ($bytes_written) { + substr $buf, 0, $bytes_written, ''; + } + elsif ($! != Errno::EAGAIN() && + $! != Errno::EINTR()) { + $self->_set_error(LIBSSH2_ERROR_FILE(), "Unable to write to local file: $!"); + return; + } + } + } + elsif (!defined($bytes_read) and + $self->error != LIBSSH2_ERROR_EAGAIN()) { + return; + } } # process SCP acknowledgment and send same - my $eof; - $chan->read($eof, 1); + $chan->read(my $eof, 1); $chan->write("\0"); - undef $chan; # close return 1; } @@ -474,41 +487,53 @@ } else { $file = IO::File->new($path, O_RDONLY); - return unless $file; + unless ($file) { + $self->_set_error(LIBSSH2_ERROR_FILE(), "Unable to open local file: $!"); + return; + } binmode $file; } - $self->error($!, $!), return unless $file; + my @stat = $file->stat; - $self->error($!, $!), return unless @stat; + unless (@stat) { + $self->_set_error(LIBSSH2_ERROR_FILE(), "Unable to stat local file: $!"); + return; + } my $mode = $stat[2] & 0777; # mask off extras such as S_IFREG - my $chan = $self->_scp_put($remote, $mode, @stat[7, 8, 9]); - return unless $chan; - $chan->blocking(1); + $self->blocking(1); + my $chan = $self->_scp_put($remote, $mode, @stat[7, 8, 9]) or return; # read and transmit blocks until we're finished - for (my ($size, $count) = ($stat[7]); $size > 0; $size -= $count) { - my $buf; - my $block = ($size > 8192) ? 8192 : $size; - $count = $file->sysread($buf, $block); - $self->error($!, $!), return unless defined $count; - $self->error(0, "want $block, have $count"), return - unless $count == $block; - die 'sysread mismatch' unless length $buf == $count; - my $wrote = 0; - while ($wrote >= 0 && $wrote < $count) { - my $wr = $chan->write($buf); - last if $wr < 0; - $wrote += $wr; - $buf = substr $buf, $wr; - } - $self->error(0, "error writing $count bytes to channel"), return - unless $wrote == $count; + my $size = $stat[7]; + while ($size > 0) { + my $bytes_read = $file->sysread(my($buf), ($size > 32768 ? 32768 : $size)); + if ($bytes_read) { + $size -= $bytes_read; + while (length $buf) { + my $bytes_written = $chan->write($buf); + if (defined $bytes_written) { + substr($buf, 0, $bytes_written, ''); + } + elsif ($chan->error != LIBSSH2_ERROR_EAGAIN()) { + return; + } + } + } + elsif (defined $bytes_read) { + $self->_set_error(LIBSSH2_ERROR_FILE(), "Unexpected end of local file"); + return; + } + elsif ($! != Errno::EAGAIN() and + $! != Errno::EINTR()) { + $self->_set_error(LIBSSH2_ERROR_FILE(), "Unable to read local file: $!"); + return; + } } # send/receive SCP acknowledgement $chan->write("\0"); - return $chan->read((my $eof), 1) || undef; + return $chan->read(my($eof), 1) || undef; } my %Event; @@ -741,6 +766,9 @@ Returns the last error code; returns false if no error. In list context, returns (code, error name, error string). +Note that the returned error value is only meaningful after some other +method indicates an error by returning false. + =head2 sock Returns a reference to the underlying L object (usually a diff -Nru libnet-ssh2-perl-0.56/Makefile.PL libnet-ssh2-perl-0.58/Makefile.PL --- libnet-ssh2-perl-0.56/Makefile.PL 2015-08-23 16:13:27.000000000 +0000 +++ libnet-ssh2-perl-0.58/Makefile.PL 2015-12-06 09:07:24.000000000 +0000 @@ -1,7 +1,6 @@ use inc::Module::Install 0.91; use Cwd; use Config; -use Module::Install::CheckLib (); # override library and include directories here if desired my $lib = $ENV{LIBSSH2_LIB} || ''; @@ -55,6 +54,23 @@ all_from 'lib/Net/SSH2.pm'; perl_version '5.006000'; +my @extra_search_paths; + +# mac homebrew support +if ($^O eq 'darwin' && -x '/usr/local/bin/brew') { + system("/usr/local/bin/brew info libssh2 | grep '^Not installed' >/dev/null"); + if ($? >> 8 == 0) { + system("/usr/local/bin/brew -v install libssh2"); + } + system("/usr/local/bin/brew info openssl | grep '^Not installed' >/dev/null"); + if ($? >> 8 == 0) { + system("/usr/local/bin/brew -v install openssl"); + } + + push @extra_search_paths, + (sort { (stat($b))[9] <=> (stat($a))[9] } glob('/usr/local/Cellar/openssl/*'))[0]; +} + my @search_paths = ( (split /\Q$Config{path_sep}\E/, $ENV{LD_RUN_PATH}), (split /\Q$Config{path_sep}\E/, ($^O eq 'darwin' ? @@ -63,6 +79,7 @@ (split ' ', $Config{libspath}), $Config{siteprefixexp}, $Config{prefixexp}, '/usr/local/ssl', '/usr', '/usr/local', '/opt', '/opt/local', '/', + @extra_search_paths ); my %seen; @@ -114,13 +131,25 @@ EOF if (!$lib && !$inc) { - - checklibs - lib => 'ssh2', - header => 'libssh2.h', - libpath => [@search_libs], - incpath => [@search_incs], - ; + checklibs( lib => 'ssh2', + header => 'libssh2.h', + libpath => [@search_libs], + incpath => [@search_incs] ); + + unless ($win32) { + if ($use_gcrypt) { + checklibs( lib => 'gcrypt', + header => 'gcrypt.h', + libpath => [@search_libs], + incpath => [@search_incs] ); + } + else { + checklibs( lib => 'ssl', + header => 'openssl/crypto.h', + libpath => [@search_libs], + incpath => [@search_incs] ); + } + } $lib = (join ' ', map "-L$_", @search_libs) . " -lssh2 $extra_libs"; $inc = join ' ', map "-I$_", @search_incs; diff -Nru libnet-ssh2-perl-0.56/MANIFEST libnet-ssh2-perl-0.58/MANIFEST --- libnet-ssh2-perl-0.56/MANIFEST 2015-09-13 07:09:18.000000000 +0000 +++ libnet-ssh2-perl-0.58/MANIFEST 2015-12-06 09:07:24.000000000 +0000 @@ -1,6 +1,8 @@ BUILDING.WIN32 Changes example/read.pl +example/rt58911.pl +example/rt80011.pl fallback/const-c.inc fallback/const-xs.inc inc/Devel/CheckLib.pm @@ -25,8 +27,6 @@ MANIFEST This list of files MANIFEST.SKIP META.yml -MYMETA.json -MYMETA.yml ppport.h README SSH2.xs diff -Nru libnet-ssh2-perl-0.56/MANIFEST.SKIP libnet-ssh2-perl-0.58/MANIFEST.SKIP --- libnet-ssh2-perl-0.56/MANIFEST.SKIP 2015-08-27 16:20:54.000000000 +0000 +++ libnet-ssh2-perl-0.58/MANIFEST.SKIP 2015-12-06 09:07:24.000000000 +0000 @@ -10,6 +10,7 @@ \.old\z \.bak\z \.tar\.gz\z +\~\z ^pm_to_blib\z ^Makefile\z ^const-c\.inc\z @@ -18,3 +19,5 @@ ^\.travis/ ^\.gitignore ^t/pod-spell.t +^MYMETA\. +^00.*\.patch\z diff -Nru libnet-ssh2-perl-0.56/META.yml libnet-ssh2-perl-0.58/META.yml --- libnet-ssh2-perl-0.56/META.yml 2015-10-09 14:06:50.000000000 +0000 +++ libnet-ssh2-perl-0.58/META.yml 2015-12-20 07:49:58.000000000 +0000 @@ -22,7 +22,7 @@ provides: Net::SSH2: file: lib/Net/SSH2.pm - version: '0.56' + version: '0.58' Net::SSH2::Channel: file: lib/Net/SSH2/Channel.pm Net::SSH2::Dir: @@ -42,4 +42,4 @@ resources: license: http://dev.perl.org/licenses/ repository: git://github.com/rkitover/net-ssh2.git -version: '0.56' +version: '0.58' diff -Nru libnet-ssh2-perl-0.56/MYMETA.json libnet-ssh2-perl-0.58/MYMETA.json --- libnet-ssh2-perl-0.56/MYMETA.json 2015-10-09 14:06:50.000000000 +0000 +++ libnet-ssh2-perl-0.58/MYMETA.json 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -{ - "abstract" : "Support for the SSH 2 protocol via libssh2.", - "author" : [ - "- 2010 by David B. Robins (dbrobins@cpan.org)." - ], - "dynamic_config" : 0, - "generated_by" : "Module::Install version 1.16, CPAN::Meta::Converter version 2.140640", - "license" : [ - "perl_5" - ], - "meta-spec" : { - "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" - }, - "name" : "Net-SSH2", - "no_index" : { - "directory" : [ - "example", - "inc", - "t" - ] - }, - "prereqs" : { - "build" : { - "requires" : { - "ExtUtils::MakeMaker" : "6.59" - } - }, - "configure" : { - "requires" : { - "ExtUtils::MakeMaker" : "0" - } - }, - "runtime" : { - "requires" : { - "perl" : "5.006" - } - } - }, - "provides" : { - "Net::SSH2" : { - "file" : "lib/Net/SSH2.pm", - "version" : "0.55" - }, - "Net::SSH2::Channel" : { - "file" : "lib/Net/SSH2/Channel.pm" - }, - "Net::SSH2::Dir" : { - "file" : "lib/Net/SSH2/Dir.pm" - }, - "Net::SSH2::File" : { - "file" : "lib/Net/SSH2/File.pm" - }, - "Net::SSH2::KnownHosts" : { - "file" : "lib/Net/SSH2/KnownHosts.pm" - }, - "Net::SSH2::Listener" : { - "file" : "lib/Net/SSH2/Listener.pm" - }, - "Net::SSH2::PublicKey" : { - "file" : "lib/Net/SSH2/PublicKey.pm" - }, - "Net::SSH2::SFTP" : { - "file" : "lib/Net/SSH2/SFTP.pm" - } - }, - "release_status" : "stable", - "resources" : { - "license" : [ - "http://dev.perl.org/licenses/" - ], - "repository" : { - "type" : "git", - "url" : "git://github.com/rkitover/net-ssh2.git" - } - }, - "version" : "0.55" -} diff -Nru libnet-ssh2-perl-0.56/MYMETA.yml libnet-ssh2-perl-0.58/MYMETA.yml --- libnet-ssh2-perl-0.56/MYMETA.yml 2015-10-09 14:06:50.000000000 +0000 +++ libnet-ssh2-perl-0.58/MYMETA.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ ---- -abstract: 'Support for the SSH 2 protocol via libssh2.' -author: - - '- 2010 by David B. Robins (dbrobins@cpan.org).' -build_requires: - ExtUtils::MakeMaker: '6.59' -configure_requires: - ExtUtils::MakeMaker: '0' -dynamic_config: 0 -generated_by: 'Module::Install version 1.16, CPAN::Meta::Converter version 2.140640' -license: perl -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: '1.4' -name: Net-SSH2 -no_index: - directory: - - example - - inc - - t -provides: - Net::SSH2: - file: lib/Net/SSH2.pm - version: '0.55' - Net::SSH2::Channel: - file: lib/Net/SSH2/Channel.pm - Net::SSH2::Dir: - file: lib/Net/SSH2/Dir.pm - Net::SSH2::File: - file: lib/Net/SSH2/File.pm - Net::SSH2::KnownHosts: - file: lib/Net/SSH2/KnownHosts.pm - Net::SSH2::Listener: - file: lib/Net/SSH2/Listener.pm - Net::SSH2::PublicKey: - file: lib/Net/SSH2/PublicKey.pm - Net::SSH2::SFTP: - file: lib/Net/SSH2/SFTP.pm -requires: - perl: '5.006' -resources: - license: http://dev.perl.org/licenses/ - repository: git://github.com/rkitover/net-ssh2.git -version: '0.55' diff -Nru libnet-ssh2-perl-0.56/README libnet-ssh2-perl-0.58/README --- libnet-ssh2-perl-0.56/README 2015-09-13 07:06:09.000000000 +0000 +++ libnet-ssh2-perl-0.58/README 2015-10-24 16:47:36.000000000 +0000 @@ -25,7 +25,7 @@ To install dependencies: -Debian: sudo aptitude install libssh2-1-dev +Debian: sudo aptitude install libssh2-1-dev libssl-dev OpenSUSE: sudo zypper in libssh2-1 libssh2-devel OS X homebrew: brew install libssh2 diff -Nru libnet-ssh2-perl-0.56/SSH2.xs libnet-ssh2-perl-0.58/SSH2.xs --- libnet-ssh2-perl-0.56/SSH2.xs 2015-10-08 10:40:16.000000000 +0000 +++ libnet-ssh2-perl-0.58/SSH2.xs 2015-12-20 07:48:20.000000000 +0000 @@ -1212,7 +1212,6 @@ } } } - libssh2_agent_disconnect(agent); } libssh2_agent_free(agent); } @@ -1379,6 +1378,33 @@ OUTPUT: RETVAL +#if LIBSSH2_VERSION_NUM >= 0x10601 + +SSH2_CHANNEL* +net_ss__scp_get(SSH2* ss, const char* path, HV* stat = NULL) +PREINIT: + libssh2_struct_stat st; +CODE: + clear_error(ss); + NEW_CHANNEL(libssh2_scp_recv2(ss->session, path, &st)); + if (stat) { + hv_clear(stat); + hv_store(stat, "mode", 4, newSVuv(st.st_mode), 0/*hash*/); + hv_store(stat, "uid", 3, newSVuv(st.st_uid), 0/*hash*/); + hv_store(stat, "gid", 3, newSVuv(st.st_gid), 0/*hash*/); +#if IVSIZE >= 8 + hv_store(stat, "size", 4, newSVuv(st.st_size), 0/*hash*/); +#else + hv_store(stat, "size", 4, newSVnv(st.st_size), 0/*hash*/); +#endif + hv_store(stat, "atime", 5, newSVuv((time_t)st.st_atime), 0/*hash*/); + hv_store(stat, "mtime", 5, newSViv((time_t)st.st_mtime), 0/*hash*/); + } +OUTPUT: + RETVAL + +#else + SSH2_CHANNEL* net_ss__scp_get(SSH2* ss, const char* path, HV* stat = NULL) PREINIT: @@ -1398,6 +1424,8 @@ OUTPUT: RETVAL +#endif + SSH2_CHANNEL* net_ss__scp_put(SSH2* ss, const char* path, int mode, size_t size, \ long mtime = 0, long atime = 0) diff -Nru libnet-ssh2-perl-0.56/t/Net-SSH2.t libnet-ssh2-perl-0.58/t/Net-SSH2.t --- libnet-ssh2-perl-0.56/t/Net-SSH2.t 2015-10-09 13:51:26.000000000 +0000 +++ libnet-ssh2-perl-0.58/t/Net-SSH2.t 2015-12-20 07:48:20.000000000 +0000 @@ -22,6 +22,8 @@ my $ssh2 = Net::SSH2->new(); isa_ok($ssh2, 'Net::SSH2', 'new session'); ok(!$ssh2->error(), 'error state clear'); +#$ssh2->trace(-1); + ok($ssh2->banner('SSH TEST'), 'set banner'); is(LIBSSH2_ERROR_SOCKET_NONE(), -1, 'LIBSSH2_* constants'); @@ -161,21 +163,22 @@ # (4) SCP my $remote = "$dir/".basename($0); ok($ssh2->scp_put($0, $remote), "put $0 to remote"); + SKIP: { # SKIP-scalar -eval { require IO::Scalar }; -skip '- IO::Scalar required', 2 if $@; -my $check = IO::Scalar->new; -ok($ssh2->scp_get($remote, $check), "get $remote from remote"); -SKIP: { # SKIP-slurp -eval { require File::Slurp }; -skip '- File::Slurp required', 1 if $@; -if($^O =~ /MSWin32/i) { - is(${$check->sref}, File::Slurp::read_file($0, binmode => ':raw'), 'files match'); -} -else { - is(${$check->sref}, File::Slurp::read_file($0), 'files match'); -} -} # SKIP-slurp + eval { require IO::Scalar }; + skip '- IO::Scalar required', 2 if $@; + my $check = IO::Scalar->new; + ok($ssh2->scp_get($remote, $check), "get $remote from remote"); + SKIP: { # SKIP-slurp + eval { require File::Slurp }; + skip '- File::Slurp required', 1 if $@; + if($^O =~ /MSWin32/i) { + is(${$check->sref}, File::Slurp::read_file($0, binmode => ':raw'), 'files match'); + } + else { + is(${$check->sref}, File::Slurp::read_file($0), 'files match'); + } + } # SKIP-slurp } # SKIP-scalar # (3) rename @@ -266,4 +269,3 @@ } # SKIP-connect # vim:filetype=perl -