DiaColloDB
view release on metacpan or search on metacpan
DiaColloDB/Utils.pm view on Meta::CPAN
}
return $jxs;
}
BEGIN { *json = \&jsonxs; }
##==============================================================================
## Functions: env
## \%setenv = PACKAGE::env_set(%setenv)
sub env_set {
my $that = UNIVERSAL::isa($_[0],__PACKAGE__) ? shift : __PACKAGE__;
my %setenv = @_;
my ($key,$val);
while (($key,$val)=each(%setenv)) {
if (!defined($val)) {
#$that->trace("ENV_UNSET $key");
delete($ENV{$key});
} else {
#$that->trace("ENV_SET $key=$val");
$ENV{$key} = $val;
}
}
return \%setenv;
}
## \%oldvals = PACKAGE::env_push(%setenv)
our @env_stack = qw();
sub env_push {
my $that = UNIVERSAL::isa($_[0],__PACKAGE__) ? shift : __PACKAGE__;
my %setenv = @_;
my %oldenv = map {($_=>$ENV{$_})} keys %setenv;
push(@env_stack, \%oldenv);
$that->env_set(%setenv);
return \%oldenv;
}
## \%restored = PACKAGE::env_pop(%setenv)
sub env_pop {
my $that = UNIVERSAL::isa($_[0],__PACKAGE__) ? shift : __PACKAGE__;
my $oldvals = pop(@env_stack);
$that->env_set(%$oldvals) if ($oldvals);
return $oldvals;
}
##==============================================================================
## Functions: run
DiaColloDB/Utils.pod view on Meta::CPAN
##========================================================================
## JSON: save
$str = PACKAGE::saveJsonString($data);
$bool = PACKAGE::saveJsonFile($data,$filename_or_handle,%opts);
##========================================================================
## Functions: env
\%setenv = PACKAGE::env_set(%setenv);
\%restored = PACKAGE::env_pop(%setenv);
##========================================================================
## Functions: run
$fh_or_undef = PACKAGE::opencmd($cmd);
$bool = crun(@IPC_Run_args);
$bool = csort_to(\@sortargs, \&catcher);
$bool = csortuc_to(\@sortargs, \&catcher);
$cmd = sortCmd();
DiaColloDB/Utils.pod view on Meta::CPAN
=head2 Functions: env
=over 4
=item Variable: @env_stack
Stack of temporary environment variables.
=item env_set
\%setenv = PACKAGE::env_set(%setenv);
Set or clear environment variables.
=item env_push
\%oldvals = PACKAGE::env_push(%setenv);
Push old values for keys(%setenv) to @env_stack
and calls env_set(%setenv).
=item env_pop
\%restored = PACKAGE::env_pop(%setenv);
Pops the most recent variable bindings from @env_stack
and restores them to the environment.
=back
=cut
##----------------------------------------------------------------
## DESCRIPTION: DiaColloDB::Utils: Functions: run
( run in 0.449 second using v1.01-cache-2.11-cpan-3989ada0592 )