Hash reference. The child process will populate %ENV with the items of the
hash before calling exec. This allows exporting environment variables.
+=item delete_env
+
+Array reference. The child process will remove all environment variables
+listed in the array before calling exec.
+
=back
=cut
error("parameter env must be a hash reference");
}
+ if (exists $opts{"delete_env"} and ref($opts{"delete_env"}) ne 'ARRAY') {
+ error("parameter delete_env must be an array reference");
+ }
+
return %opts;
}
$ENV{$_} = $opts{"env"}{$_};
}
}
+ if ($opts{"delete_env"}) {
+ delete $ENV{$_} foreach (@{$opts{"delete_env"}});
+ }
# Change the current directory
if ($opts{"chdir"}) {
chdir($opts{"chdir"}) || syserr(_g("chdir to %s"), $opts{"chdir"});