Psh/Support/Functions.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 29 CC 2 SCAR 11.5
CC
2
Cov
0%
call_function
6.0
add_function
2.0
remove_function
2.0
CRAP 3.1
1 package Psh::Support::Functions;
2  
3 require Psh;
4  
5 my %functions=();
6  
7 sub add_function {
8 my $name= shift;
9 my $text= shift;
10 $functions{$name}= [map { $_."\n" } split /\n/, $text];
11 }
12  
13 sub call_function {
14 my $name= shift;
15 Psh::process_variable($functions{$name}) if $functions{$name};
16 }
17  
18 sub remove_function {
19 my $name= shift;
20 delete $functions{$name};
21 }
22  
23 sub get_function {
24 my $name= shift;
25 return $functions{$name};
26 }
27  
28 sub list {
29 return sort keys %functions;
30 }
31  
32 1;