1Rex::Shared::Var(3)   User Contributed Perl Documentation  Rex::Shared::Var(3)
2
3
4

NAME

6       Rex::Shared::Var - Share variables across Rex tasks
7

DESCRIPTION

9       Share variables across Rex tasks with the help of Storable, using a
10       "vars.db.$PID" file in the local directory, where $PID is the PID of
11       the parent process.
12

SYNOPSIS

14        BEGIN {                           # put share in a BEGIN block
15          use Rex::Shared::Var;
16          share qw($scalar @array %hash); # share the listed variables
17        }
18

METHODS

20   share
21       Share the passed list of variables across Rex tasks. Should be used in
22       a "BEGIN" block.
23
24        BEGIN {
25          use Rex::Shared::Var;
26          share qw($error_count);
27        }
28
29        task 'count', sub {
30          $error_count += run 'wc -l /var/log/syslog';
31        };
32
33        after_task_finished 'count', sub {
34          say "Total number of errors: $error_count";
35        };
36
37
38
39perl v5.30.0                      2019-07-24               Rex::Shared::Var(3)
Impressum