Rex::C...s::Host(3pm)
π Rex::Commands::Host β bestie's guide to /etc/hosts π
okay so real talk, this page is Rex::Commands::Host, and it's filed under the Perl documentation (the 3pm girly π
) in the User Contributed Perl Documentation section. if you've ever wanted your config management to just handle your hosts file for you... bestie, you're home. π β¨
πΈ NAME πΈ
Rex::Commands::Host β Edit /etc/hosts
like. that's literally it. that's the whole job. and she does it so well. no cap.
π¦ DESCRIPTION π¦
With this module you can manage the host entries in /etc/hosts. π
that's it. that's the vibe. you get to be the main character of your own hosts file instead of hand-editing it like some sort of animal. obsessed, honestly. π
β¨ SYNOPSIS β¨
here's a lil taste of what it looks like in the wild, bestie:
task "create-host", "remoteserver", sub {
create_host "rexify.org" => {
ip => "88.198.93.110",
aliases => ["www.rexify.org"],
};
};
see how chill that is?? a whole task, a whole host entry, zero stress. ate. π
π EXPORTED FUNCTIONS π
the goods. the icons. the moment. π«Ά
π host_entry($name, %option)
Manages the entries in /etc/hosts. she's the flexible one, she takes options, she takes vibes.
host_entry "rexify.org",
ensure => "present",
ip => "88.198.93.110",
aliases => ["www.rexify.org"],
on_change => sub { say "added host entry"; };
host_entry "rexify.org",
ensure => "absent",
on_change => sub { say "removed host entry"; };
so <purple>ensure => "present"</purple> means add it, bestie, and ensure => "absent" means it's gone, periodt. and that on_change callback?? she runs when the thing actually changes, and she is iconic for it. π₯
π create_host($)
Update or create a /etc/hosts entry. it's giving "make it exist, or fix it if it's already there."
create_host "rexify.org", {
ip => "88.198.93.110",
aliases => ["www.rexify.org", ...]
};
that ... in the aliases array is doing the most and honestly? relatable. π
π delete_host($host)
Delete a host from /etc/hosts. bye bye. no notes. π
delete_host "www.rexify.org";
π§ get_host($host)
Returns the information of $host in /etc/hosts. she's the nosy one and we love her for it. π
my @host_info = get_host "localhost";
say "Host-IP: " . $host_info[0]->{"ip"};
look how easy that is β $host_info[0]->{"ip"} and boom, you've got the IP. slay. β
lowkey reminder: this all edits /etc/hosts, which is a real system file, and it's the only file this module touches. treat her with respect, bestie. π
and that's the whole page, fr fr. no filler, no skips, every function accounted for. π
perl v5.40.1 Β· 2025-10-03 Β· Rex::Commands::Host(3pm) β thanks for coming to my ted talk, go edit some hosts, ily, bye!! ππ¦π β¨
π¦ where this page comes from
- ubuntu resolute: rex 1.16.1-1 Β· Apache-2.0
- ubuntu stonking: rex 1.16.1-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms