- SEE ALSO
- COPYRIGHT AND LICENSE
XAS::Lib::SSH::Client - A SSH based client
use XAS::Lib::SSH::Client; my $client = XAS::Lib::SSH::Client->new( -host => 'auburn-xen-01', -username => 'root', -password => 'secret', ); $client->connect(); $client->put($data); $data = $client->get(); $client->disconnect();
The module provides basic network connectivity along with input/output methods using the SSH protocol. It can authenticate using username/password or username/public key/private key/password.
This initializes the object. It takes the following parameters:
An optional username to use when connecting to the server.
An optional password to use for authentication.
An optional public ssh key file to use.
An optional private ssh key to use.
The server to connect too. Defaults to 'localhost'.
The port to use on the server. It defaults to 22.
The number of seconds to timeout writes. It must be compatible with IO::Select. Defaults to 0.2.
The EOL to use, defaults to "\015\012".
This method makes a connection to the server.
This method sets up the channel to be used. It needs to be overridden to be useful.
This block reads data from the channel. A buffer is returned when it reaches $length or timeout, whichever is first.
This reads a buffer delimited by the eol from the channel.
A class method to return the SSH error number.
A class method to return the SSH error string.
This method will write a buffer to the channel. Returns the number of bytes written.
This writes a buffer that is terminated with eol to the channel. Returns the number of bytes written.
This method closes the connection.
This is used when reading data from the channel. It triggers how many times to attempt reading from the channel when a LIBSSH2_ERROR_EAGAIN error occurs. The default is 5 times.
Kevin L. Esteb, <email@example.com>
Copyright (c) 2012-2015 Kevin L. Esteb
This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.