| Net-SSH-W32Perl documentation | Contained in the Net-SSH-W32Perl distribution. |
Net::SSH::W32Perl - MSWin32 compatibility layer for Net::SSH::Perl
use Net::SSH::W32Perl;
my $host = 'foo.bar.com';
my $ssh = new Net::SSH::W32Perl($host, [options]);
$ssh->login('user', 'password');
my ($out, $err, $exit) = $ssh->cmd('cat', 'Hello Net::SSH::W32Perl User!');
This module provides limited Net::SSH::Perl functionality under MSWin32 (ActivePerl). See Net::SSH::Perl for a functional description.
When used on non-MSWin32 systems, Net::SSH::W32Perl reverts to traditional Net::SSH::Perl functionality.
SSH2 is the default protocol under MSWin32. Specifying a protocol other than SSH2 will cause SSH2 to die() - see below.
shell() interface is not supported due to MSWin32's
lack of support for select() on non-socket filehandles. Integrate the Net::SSH::Perl tests, fix privileged, etc...
Scott Scecina, <scotts@inmind.com>
Except where otherwise noted, Net::SSH::W32Perl is Copyright 2001 Scott Scecina. All rights reserved. Net::SSH::W32Perl is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
Code taken from Net::SSH::Perl is Copyright 2001 Benjamin Trott. Please see Net::SSH::Perl for more information.
| Net-SSH-W32Perl documentation | Contained in the Net-SSH-W32Perl distribution. |
package Net::SSH::W32Perl; use strict; use Carp; use IO::Socket; use Net::SSH::Perl; use Net::SSH::Perl::Constants qw( :protocol ); use constant DEFAULT_SSH_PORT => '22'; use constant IS_WIN32 => ($^O =~ /MSWin32/i); use vars qw/ $VERSION @ISA/; $VERSION = '0.05'; @ISA = qw/Net::SSH::Perl/; sub _init { my $ssh = shift; my %arg = @_; $arg{protocol} = 2 unless exists $arg{protocol}; $ssh->SUPER::_init(%arg); } sub _connect { my $ssh = shift; return $ssh->SUPER::_connect(@_) unless IS_WIN32; my $rport = $ssh->{config}->get('port') || DEFAULT_SSH_PORT; my $rhost = $ssh->{host}; $ssh->debug("Connecting to $ssh->{host}, port $rport."); my $sock = IO::Socket::INET->new( PeerAddr => $rhost, PeerPort => $rport, Proto => 'tcp' ) || die "Can't connect to $rhost: $!\n"; $ssh->{session}{sock} = $sock; my $t = $|; $| = 0; $ssh->debug("Socket created, turning on blocking..."); $sock->blocking(1); $ssh->_exchange_identification; $sock->blocking(0); $| = $t; $ssh->debug("Connection established."); } sub protocol_class { return shift->SUPER::protocol_class(@_) unless IS_WIN32; die "SSH2 is the only supported protocol under MSWin32!" unless (PROTOCOL_SSH2 == $_[1]); return 'Net::SSH::W32Perl::SSH2'; } sub Close {} 1; __END__