Last active
September 23, 2022 07:51
-
-
Save rwp0/7c35720c931d637aef2b5a7d3519b70f to your computer and use it in GitHub Desktop.
Rex Task Arguments / Parameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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