5 Env - Perl module that imports environment variables
9 Perl maintains environment variables in a pseudo-associative-array
10 named %ENV. For when this access method is inconvenient, the Perl
11 module C<Env> allows environment variables to be treated as simple
14 The Env::import() function ties environment variables with suitable
15 names to global Perl variables with the same names. By default it
16 does so with all existing environment variables (C<keys %ENV>). If
17 the import function receives arguments, it takes them to be a list of
18 environment variables to tie; it's okay if they don't yet exist.
20 After an environment variable is tied, merely use it like a normal variable.
21 You may access its value
23 @path = split(/:/, $PATH);
30 To remove a tied environment variable from
31 the environment, assign it the undefined value
37 Chip Salzenberg <chip@fin.uucp>
42 my ($callpack) = caller(0);
44 my @vars = @_ ? @_ : keys(%ENV);
47 tie ${"${callpack}::$_"}, Env, $_ if /^[A-Za-z_]\w*$/;
61 my ($self, $value) = @_;
62 if (defined($value)) {
63 $ENV{$$self} = $value;