Created
May 23, 2020 13:20
-
-
Save ferki/dfe59dda22710c719c17697ccb193051 to your computer and use it in GitHub Desktop.
collect task results to display after the task
This file contains 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
use strict; | |
use warnings; | |
use Rex -feature => [ '1.4', 'exec_autodie' ]; | |
use Data::Printer; | |
BEGIN { | |
use Rex::Shared::Var; | |
share qw(%results_for); | |
} | |
task 'status_line', sub { | |
say 'doing stuff'; | |
# collecting results | |
my $hostname = run 'hostname'; | |
my $result = run 'whoami'; | |
$results_for{$hostname} = $result; | |
}; | |
after_task_finished 'status_line' => sub { | |
say 'Collected results:'; | |
p %results_for; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment