Net::SS...:Config(3)

πŸ“¦
version 2.144 Β· 4 versions
, in fedora 44

πŸ’– Net::SS...:Config(3) πŸ’–

okay bestie, so this is the manual page for Net::SSH::Perl::Config, and it lives in the User Contributed Perl Documentation section of the perl manpages. yes the header literally says Net::SS...:Config(3) because manpages truncate like that, it's giving budget cuts but we move. πŸ’…


✨ NAME ✨

Net::SSH::Perl::Config β€” load and manage SSH configuration, no cap πŸŽ€


🌸 SYNOPSIS 🌸

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');

see how easy that is?? iconic. ⭐


πŸ¦‹ DESCRIPTION πŸ¦‹

so Net::SSH::Perl::Config is the girlboss that manages all the configuration data for Net::SSH::Perl. she does two things and she does them well: she merges the options you hand her when you build the object with the options she reads from configuration files. periodt. πŸ’–

and here's the rule, and it's the main character rule, fr fr: just like in the actual ssh program, the first obtained value of a configuration parameter is the value that gets used. so basically, values you put in the original parameter list will always override values read from configuration files. first come, first served, and the first one ate. πŸ‘‘

now, the configuration files should be in the same format used for the ssh command line program β€” go check the ssh manpage for info on that format, i'm not retyping it for you bestie, it's right there. πŸ™ˆ

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. and unknown keywords? she simply skips them. not her problem, not her business. πŸ’…


🌈 USAGE 🌈

πŸ’œ Net::SSH::Perl::Config->new($host, %args)

constructs a new configuration container object and returns that object. slay.

$host is the host you're applying this configuration to. you can leave it out (pass in an undefined or empty argument) if it's not applicable to you β€” no pressure, it's fine, she's flexible. 🫢

so why is $host needed? glad you asked bestie. it's for parsing the host-specific sections of the configuration files. the Host keyword restricts a set of directives so they only apply to a particular host (or set of hosts). and when she encounters such a section, Net::SSH::Perl::Config will skip all of the directives in that section unless the host matches $host. vibe check: if it's not your host, it's not your section, move along. ✨

%args can contain the same arguments that you can pass to the new method of Net::SSH::Perl β€” those arguments eventually get passed through to this method when setting up the SSH object. and the elements in %args override values in the configuration files. they said what they said. πŸ”₯

πŸŽ€ $cfg->read_config($file)

reads in the configuration file $file and adds any appropriate configuration data to the settings maintained by the $cfg object.

and if $file is unreadable? she just returns quietly. no drama, no error, no scene. she's above it. πŸ’…

as stated above (you were paying attention, right bestie), 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. earliest girl wins, every single time. πŸ‘‘

🧚 $cfg->merge_directive($line)

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". and 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. sneak it in, nobody has to know. 😭

πŸ’– $cfg->get($key)

returns the value of the configuration parameter $key, and undefined if that parameter has not been set. if she doesn't have it, she gives you undef, and honestly? respectful.

πŸ“ $cfg->set($key, $value)

sets the value of the parameter $key to $value, and returns the new value. yes she gives it back to you, she's generous like that. 🫢


πŸ‘‘ AUTHOR & COPYRIGHTS πŸ‘‘

please see the Net::SSH::Perl manpage for author, copyright, and license information. that's where all the legal lore lives, i'm not doing paperwork bestie. πŸ“œ


and that's the whole page!! this was perl v5.42.0, dated 2026-01-17, and honestly it ate. πŸ’…βœ¨ go read your config files, ily, bye πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from