24 Aug 2017 05:51:41 UTC
- Distribution: Net-SSH-Perl
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (61)
- Testers (1710 / 0 / 0)
- KwaliteeBus factor: 2
- 47.96% Coverage
- License: perl_5
- Activity24 month
- Download (250.94KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:8 non-PAUSE usersSCHWIGON Steffen Schwigonand 2 contributors
- David Robins
- Lance Kinley
- AUTHOR & COPYRIGHTS
Net::SSH::Perl::Config - Load and manage SSH configuration
use Net::SSH::Perl::Config; my $cfg = Net::SSH::Perl::Config->new($host, foo => 'bar'); $cfg->read_config($config_file); my $v = $cfg->get('foo');
Net::SSH::Perl::Config manages configuration data for Net::SSH::Perl. It merges options handed to it at object construction with options read from configuration files. Just as in the actual ssh program, the first obtained value of a configuration parameter is the value that's used; in other words, values given in the original parameter list will always override values read from configuration files.
The configuration files should be in the same format used for the ssh command line program; see the ssh manpage for information on this format. Net::SSH::Perl::Config understands a subset of the configuration directives that can live in these files; this subset matches up with the functionality that Net::SSH::Perl can support. Unknown keywords will simply be skipped.
Constructs a new configuration container object and returns that object. $host is the host to which you're applying this configuration; you can leave it out (pass in an undefined or empty argument) if it's not applicable to you.
$host is needed for parsing the host-specific sections of the configuration files; the Host keyword restricts a set of directives as applying to a particular host (or set of hosts). When it encounters such a section, Net::SSH::Perl::Config will skip all of the directives in the section unless the host matches $host.
%args can contain the same arguments that you can pass to the new method of Net::SSH::Perl--those arguments are eventually passed through to this method when setting up the SSH object. The elements in %args override values in the configuration files.
Reads in the configuration file $file and adds any appropriate configuration data to the settings maintained by the $cfg object. If $file is unreadable, simply returns quietly.
As stated above, values read from the configuration files are overridden by those passed in to the constructor. Furthermore, if you're reading from several config files in sequence, values read from the first files will override those read from the second, third, fourth, etc. files.
Merges the directive option $line into the configuration settings in $cfg. $line should be an option in the format used in the config file, eg. "BatchMode yes". This is useful for merging in directives that are not necessarily in the config file, similar to how the -o option works in the ssh command line program.
Returns the value of the configuration parameter $key, and undefined if that parameter has not been set.
Sets the value of the parameter $key to $value, and returns the new value.
Please see the Net::SSH::Perl manpage for author, copyright, and license information.
Module Install Instructions
To install Net::SSH::Perl, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Net::SSH::Perl
For more information on module installation, please visit the detailed CPAN module installation guide.