App::C...H::Host(3pm)

πŸ’– App::C...H::Host πŸ’–

User Contributed Perl Documentation Β· the ClusterSSH host object, bestie πŸ¦‹


okay so real talk: this entire page is about ONE lil object that holds everything you need to actually go talk to a machine. 🌸 where it lives, who you are when you get there, which port you're knocking on. that's it. that's the module. and honestly? it ate. πŸ’…


✨ SYNOPSIS ✨

use ClusterSSH::Host;

my $host = ClusterSSH::Host->new({
    hostname => 'hostname',
});
my $host = ClusterSSH::Host->parse_host_string('username@hostname:1234');

🌸 DESCRIPTION 🌸

An object representing a host. like, it's a lil bundle of everything you need to contact that host β€” hostname / ipaddress, username, and port. all cozy in one object. 🫢


πŸ‘‘ METHODS πŸ‘‘

πŸ’« $host=ClusterSSH::Host->new ({ hostname => 'hostname' })

Creates a brand new host object, no cap. 'hostname' is a required arg β€” you cannot skip it, bestie, it will simply not happen. 'username' and 'port' are optional, so vibe check them if you want. πŸŽ€

if anything goes sideways while it's building, it raises an exception. so wrap it or weep. 😭

πŸ’« the getters

  • $host->get_hostname
  • $host->get_username
  • $host->get_port
  • $host->get_master
  • $host->get_geometry
  • $host->get_type

These ones return specific details about the host. just, you know, hand them over. 🀲

πŸ’« the setters

  • $host->set_username
  • $host->set_port
  • $host->set_master
  • $host->set_geometry
  • $host->set_type

And these ones set specific details about the host β€” but only after it's already been created. post-creation glow-up energy. ✨

πŸ’« get_realname

If the server name you gave it is not an IP address (and we mean either IPv4 or IPv6, both count, don't play πŸ™ˆ), it attempts to resolve it and returns the discovered names. it's giving detective. πŸ”

πŸ’« get_givenname

Alias to get_hostname, and you specifically want it when get_realname might return something different. iykyk. πŸ’œ

πŸ’« parse_host_string

Given a host string, it returns a host object. Parses hosts such as... and then, okay, the original page just parks the whole list of formats further down, so that's exactly where we're putting it too. scroll a lil. 🫢

πŸ’« check_ssh_hostname

Checks the object's hostname to see whether or not it may be configured within the user's $HOME/.ssh/config configuration file. yes, that config file. the one you've been editing at 2am. πŸŒ™

πŸ’« read_ssh_file

A method to ease reading in ssh configuration files. Used for grabbing hostnames for validation when used in clusters. 🧚

and here's the list of host shapes it copes with (this is literally where the original drops it, right here, no we did not move it):

  • host
  • 192.168.0.1
  • user@host
  • user@192.168.0.1
  • host:port
  • [1234:1234:1234::4567]:port
  • 1234:1234:1234::4567

and so on. πŸ’€

It copes with IPv4 and IPv6 addresses β€” but it raises a warning if the IPv6 address is ambiguous. like, in that last example: is the 4567 part of the IPv6 address, or is it a port definition?? bestie it does not know. it assumes it is part of the address. 😭

Use brackets to avoid seeing the warning. that's the fix, that's the whole fix, brackets. πŸŽ€

perl v5.42.2 Β· 2026-05-05 Β· App::C...H::Host(3pm)

okay that's the whole page, go ssh somewhere cute, ily, bye πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from