Rex::Co...ds::Tail(3)

πŸ“¦ version 1.14.3, in nixos 26.05, nixpkgs unstable

πŸ¦‹ Rex::Commands::Tail β€” bestie, let's tail a file πŸ’…

okay so this page is from the User Contributed Perl Documentation for Rex::Commands::Tail(3), and honestly? it's short, it's sweet, and it does exactly one thing. let's get into it ✨


🌸 NAME 🌸

Rex::Commands::Tail β€” literally just tail a file. that's the whole vibe. πŸŽ€

⚠️ heads up, bestie: Version <= 1.0: All these functions will not be reported.
⚠️ and also, no cap: All these functions are not idempotent. so don't go thinking you can run them twice and get the same result β€” that's not the energy here πŸ™ˆ

πŸ’– DESCRIPTION πŸ’–

With this module you can tail a file. that's it. that's the description. iconic, honestly πŸ‘‘


⭐ SYNOPSIS ⭐

 tail "/var/log/syslog";

one line. one vibe. slay πŸ’…


🧚 EXPORTED FUNCTIONS 🧚

🌈 tail($file)

This function will tail the given file. super straightforward, main character energy 🫢

here's the basic usage inside a task:

 task "syslog", "server01", sub {
   tail "/var/log/syslog";
 };

πŸ“ controlling the output format

okay so if you want to control the output format, you can define a callback function β€” this is where it gets cute πŸ˜­πŸ’–

 task "syslog", "server01", sub {
   tail "/var/log/syslog", sub {
    my ($data) = @_;

    my $server = Rex->get_current_connection()->{'server'};

    print "$server>> $data\n";
   };
 };

the way that you just hand it a sub and it hands you $data… obsessed. you grab the server name with Rex->get_current_connection()->{'server'}, and you're printing "$server>> $data\n" like the icon you are πŸ”₯


πŸ‘‘ little recap for the girlies πŸ‘‘

  • tail($file) tails the given file. periodt.
  • want custom output? pass a callback sub. it receives ($data). πŸ’œ
  • not idempotent. not reported in Version <= 1.0. don't forget it. 🧠✨

🌟 and that's the whole page, bestie β€” go tail some logs and have a gorgeous day πŸ’–

β€” with love, from the perl v5.42.3 docs, dated 2023-08-05 πŸŽ€

πŸ“¦ where this page comes from