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 for‐
24 mat. Net::SSH::Perl::Config understands a subset of the configuration
25 directives that can live in these files; this subset matches up with
26 the functionality that Net::SSH::Perl can support. Unknown keywords
27 will simply be skipped.
28
30 Net::SSH::Perl::Config->new($host, %args)
31
32 Constructs a new configuration container object and returns that
33 object. $host is the host to which you're applying this configuration;
34 you can leave it out (pass in an undefined or empty argument) if it's
35 not applicable to you.
36
37 $host is needed for parsing the host-specific sections of the configu‐
38 ration files; the Host keyword restricts a set of directives as apply‐
39 ing to a particular host (or set of hosts). When it encounters such a
40 section, Net::SSH::Perl::Config will skip all of the directives in the
41 section unless the host matches $host.
42
43 %args can contain the same arguments that you can pass to the new
44 method of Net::SSH::Perl--those arguments are eventually passed through
45 to this method when setting up the SSH object. The elements in %args
46 override values in the configuration files.
47
48 $cfg->read_config($file)
49
50 Reads in the configuration file $file and adds any appropriate configu‐
51 ration data to the settings maintained by the $cfg object. If $file is
52 unreadable, simply returns quietly.
53
54 As stated above, values read from the configuration files are overriden
55 by those passed in to the constructor. Furthermore, if you're reading
56 from several config files in sequence, values read from the first files
57 will override those read from the second, third, fourth, etc. files.
58
59 $cfg->merge_directive($line)
60
61 Merges the directive option $line into the configuration settings in
62 $cfg. $line should be an option in the format used in the config file,
63 eg. "BatchMode yes". This is useful for merging in directives that are
64 not necessarily in the config file, similar to how the -o option works
65 in the ssh command line program.
66
67 $cfg->get($key)
68
69 Returns the value of the configuration parameter $key, and undefined if
70 that parameter has not been set.
71
72 $cfg->set($key, $value)
73
74 Sets the value of the parameter $key to $value, and returns the new
75 value.
76
78 Please see the Net::SSH::Perl manpage for author, copyright, and
79 license information.
80
81
82
83perl v5.8.8 2003-12-03 Net::SSH::Perl::Config(3)