Shell-EnvImporter
view release on metacpan or search on metacpan
lib/Shell/EnvImporter/Shell/csh.pm view on Meta::CPAN
################
sub env_export {
################
my $self = shift;
my %values = (@_ == 1 ? %{$_[0]} : @_);
my @sets;
foreach my $var (sort keys %values) {
if (defined($values{$var})) {
push(@sets, "setenv $var $values{$var}");
} else {
push(@sets, "unsetenv $var");
}
}
return join($self->cmdsep, @sets);
}
1;
t/Shell-EnvImporter.t view on Meta::CPAN
# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.
##############################################################################
# Config variables
#
my $file = 't/test_script';
my $sh_script = "ADD_VAR=1;MOD_VAR=1;unset DEL_VAR;export ADD_VAR MOD_VAR DEL_VAR";
my $csh_script = "setenv ADD_VAR 1; setenv MOD_VAR 1; unsetenv DEL_VAR";
my $perl_script = '$ENV{"MOD_VAR"}=1;$ENV{"ADD_VAR"}=1;delete $ENV{"DEL_VAR"};';
my %scripts = (
sh => $sh_script,
bash => $sh_script,
zsh => $sh_script,
# ksh => $sh_script, # Untested, as I don't have ksh
csh => $csh_script,
( run in 0.331 second using v1.01-cache-2.11-cpan-283623ac599 )