Rex::Shared::Var - Share variables across Rex tasks
Share variables across Rex tasks with the help of Storable, using a vars.db.$PID file in the local directory, where $PID is the PID of the parent process.
vars.db.$PID
$PID
BEGIN { # put share in a BEGIN block use Rex::Shared::Var; share qw($scalar @array %hash); # share the listed variables }
Share the passed list of variables across Rex tasks. Should be used in a BEGIN block.
BEGIN
BEGIN { use Rex::Shared::Var; share qw($error_count); } task 'count', sub { $error_count += run 'wc -l /var/log/syslog'; }; after_task_finished 'count', sub { say "Total number of errors: $error_count"; };
To install Rex, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Rex
CPAN shell
perl -MCPAN -e shell install Rex
For more information on module installation, please visit the detailed CPAN module installation guide.