Net::SSH::Mechanize::ConnectParams - encapsulates information about an ssh connection
version 0.1.3
This class is just a container for log-in details with a method which constructs an approprate ssh command invocation.
ssh
This equates to /usr/bin/ssh -t somewhere.com sh:
/usr/bin/ssh -t somewhere.com sh
my $minimal_params = Net::SSH::Mechanize::ConnectParams->new( host => 'somewhere.com', );
This equates to /usr/bin/ssh -l someone -p 999 -t somewhere.com sh:
/usr/bin/ssh -l someone -p 999 -t somewhere.com sh
my $all_params = Net::SSH::Mechanize::ConnectParams->new( host => 'somewhere.com', user => 'someone', port => 999, password => 'secret', );
$obj = $class->new(%parameters)
Creates a new instance. Parameters is a hash or a list of key-value parameters. Valid parameter keys are:
host
The hostname to connect to (a scalar string). Either this or connection_params must be supplied.
connection_params
user
The name of the user account to log into (a scalar string). If not given, no user will be supplied to ssh (this typically means it will use the current user as default).
port
The port to connect to (a positive scalar integer; ssh will default to 22 if this is not specificed).
password
The password to connect with (a scalar string). This is only required if authentication will be performed, either on log-in or when sudoing.
$obj->host
$obj->user
$obj->password
$obj->port
These are all read-write accessors for the attribute parameters accepted by the constructor.
$cmd = $obj->ssh_cmd
This constructs the ssh command to invoke. If you need something different, you can create a subclass which overrides this method, and pass that via the connection_params parameter to Net::SSH::Mechanize->new().
Net::SSH::Mechanize->new()
Nick Stokoe <wulee@cpan.org>
<wulee@cpan.org>
Copyright (c) 2011, Nick Stokoe <wulee@cpan.org>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install Net::SSH::Mechanize, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::SSH::Mechanize
CPAN shell
perl -MCPAN -e shell install Net::SSH::Mechanize
For more information on module installation, please visit the detailed CPAN module installation guide.