1Net::SSH::Perl::Config(U3s)er Contributed Perl DocumentatNieotn::SSH::Perl::Config(3)
2
3
4
6 Net::SSH::Perl::Config - Load and manage SSH configuration
7
9 use Net::SSH::Perl::Config;
10 my $cfg = Net::SSH::Perl::Config->new($host, foo => 'bar');
11 $cfg->read_config($config_file);
12 my $v = $cfg->get('foo');
13
15 Net::SSH::Perl::Config manages configuration data for Net::SSH::Perl.
16 It merges options handed to it at object construction with options read
17 from configuration files. Just as in the actual ssh program, the first
18 obtained value of a configuration parameter is the value that's used;
19 in other words, values given in the original parameter list will always
20 override values read from configuration files.
21
22 The configuration files should be in the same format used for the ssh
23 command line program; see the ssh manpage for information on this
24 format. Net::SSH::Perl::Config understands a subset of the
25 configuration directives that can live in these files; this subset
26 matches up with the functionality that Net::SSH::Perl can support.
27 Unknown keywords will simply be skipped.
28
30 Net::SSH::Perl::Config->new($host, %args)
31 Constructs a new configuration container object and returns that
32 object. $host is the host to which you're applying this configuration;
33 you can leave it out (pass in an undefined or empty argument) if it's
34 not applicable to you.
35
36 $host is needed for parsing the host-specific sections of the
37 configuration files; the Host keyword restricts a set of directives as
38 applying to a particular host (or set of hosts). When it encounters
39 such a section, Net::SSH::Perl::Config will skip all of the directives
40 in the section unless the host matches $host.
41
42 %args can contain the same arguments that you can pass to the new
43 method of Net::SSH::Perl--those arguments are eventually passed through
44 to this method when setting up the SSH object. The elements in %args
45 override values in the configuration files.
46
47 $cfg->read_config($file)
48 Reads in the configuration file $file and adds any appropriate
49 configuration data to the settings maintained by the $cfg object. If
50 $file is unreadable, simply returns quietly.
51
52 As stated above, values read from the configuration files are
53 overridden by those passed in to the constructor. Furthermore, if
54 you're reading from several config files in sequence, values read from
55 the first files will override those read from the second, third,
56 fourth, etc. files.
57
58 $cfg->merge_directive($line)
59 Merges the directive option $line into the configuration settings in
60 $cfg. $line should be an option in the format used in the config file,
61 eg. "BatchMode yes". This is useful for merging in directives that are
62 not necessarily in the config file, similar to how the -o option works
63 in the ssh command line program.
64
65 $cfg->get($key)
66 Returns the value of the configuration parameter $key, and undefined if
67 that parameter has not been set.
68
69 $cfg->set($key, $value)
70 Sets the value of the parameter $key to $value, and returns the new
71 value.
72
74 Please see the Net::SSH::Perl manpage for author, copyright, and
75 license information.
76
77
78
79perl v5.32.0 2020-07-28 Net::SSH::Perl::Config(3)