Skip to content

Instantly share code, notes, and snippets.

@rwp0
Last active September 23, 2022 07:51
Show Gist options
  • Save rwp0/7c35720c931d637aef2b5a7d3519b70f to your computer and use it in GitHub Desktop.
Save rwp0/7c35720c931d637aef2b5a7d3519b70f to your computer and use it in GitHub Desktop.
Rex Task Arguments / Parameters
task 'mytask', sub {
my $parameters = shift;
my $parameter1_value = $parameters->{parameter1};
my $parameter2_value = $parameters->{parameter2};
};
rex -H hostname mytask --parameter1=value1 --parameter2=value2
# https://www.rexify.org/docs/faq/index.html#howcanipassparameterstoatask
# Real-world usage example
task 'watch_website_logs', group => 'testing', sub {
my $options = shift;
my $website = $options -> {website};
my $file = path "/u/logs/$website";
tail $file,
sub { say @_ }; # no newlines w/o this callback
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment