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