Psh/Builtins/Delenv.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 26 CC 3 SCAR 20.8
CC
3
Cov
0%
bi_delenv
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 8.0
1 package Psh::Builtins::Delenv;
2  
3 require Psh::Support::Env;
4 require Psh::Util;
5  
6 =item * C<delenv NAME [NAME2 NAME3 ...]>
7  
8 Deletes the names environment variables.
9  
10 =cut
11  
12 sub bi_delenv
13 {
14 my @args= split(' ',$_[0]);
15 if( !@args) {
16 Psh::Util::print_error_i18n('usage_delenv');
17 return (0,undef);
18 }
19 foreach my $var ( @args) {
20 my @result = Psh::PerlEval::protected_eval("tied(\$$var)");
21 my $oldtie = $result[0];
22 if (defined($oldtie)) {
23 Psh::PerlEval::protected_eval("untie(\$$var)");
24 }
25 my $oldval= $ENV{$var};
26 delete($ENV{$var});
27 return (1,$oldval);
28 }
29 }
30  
31 1;