Rex::Co...ds::Host(3)
β¨ NAME β¨
okay bestie, welcome to the Rex::Co...ds::Host(3) page from the User Contributed Perl Documentation π the module is Rex::Commands::Host, and its whole personality is Edit /etc/hosts. that's it, that's the name. slay.
πΈ DESCRIPTION πΈ
with this module you can manage the host entries in /etc/hosts β literally the whole point. host entries? managed. /etc/hosts? handled. no cap. β¨
π¦ SYNOPSIS π¦
here's the vibe in code form, bestie:
task "create-host", "remoteserver", sub {
create_host "rexify.org" => {
ip => "88.198.93.110",
aliases => ["www.rexify.org"],
};
};
π EXPORTED FUNCTIONS π
these are the exported functions, and yes they are the main characters π
π host_entry($name, %option) π
this one manages the entries in /etc/hosts. it's giving host-entry manager, fr fr.
here's the ensure => "present" moment β look at that on_change callback, iconic:
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"; };
and yes, the second one is the ensure => "absent" moment β removal vibes, bestie π«Ά
π create_host($) π
update or create a /etc/hosts entry. lowkey the glow-up function for your host file, periodt.
create_host "rexify.org", {
ip => "88.198.93.110",
aliases => ["www.rexify.org", ...]
};
π¦ delete_host($host) π¦
delete a host from /etc/hosts. bye bestie π
delete_host "www.rexify.org";
π₯ get_host($host) π₯
returns the information of $host in /etc/hosts. it's giving data retrieval, and we love that for us.
my @host_info = get_host "localhost";
say "Host-IP: " . $host_info[0]->{"ip"};
okay that's the whole page, bestie π«Ά this was Rex::Co...ds::Host(3) from the User Contributed Perl Documentation, Perl v5.42.3, dated 2023-08-05 β slay and stay iconic π
π¦ where this page comes from
- nixos 26.05: perl5.42.3-Rex 1.14.3
- nixpkgs unstable: perl5.42.3-Rex 1.14.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms