Hello,
I am writing some testing scripts. At the end of each test I may have to return my environment back to it's default state using various subroutines in various modules. I realize that using the END block I can run these subroutines, however I have hundreds of these test to write and there is various formatting, etc, that is repetitious... so I want to include a single function in my END block that will accept other functions as parameters and then be able to run them from within itself.
A simple example would be:
sub function_runner {
my @exit_functions = @_;
my $counter = 1;
foreach &function (@exit_functions) {
print "Performing exit function $counter:\n"; $counter++;
&function;
}
print "\nAll exit functions completed.\n";
}
I realize this will not work as is, but the gist of what I am trying do is to be able to have function_runner(function1, function2, function3, etc) in my end block. Any help point me in the right direction would be greatly appreciated.
Thanks!