in reply to How to make check process more elegant
This would enable you to add many more checks, and to factor our those checks in common. You might wish to change the design of the hash if the entities are not unique, or if you wish to do more than one check on each item. You could place the checking subroutines in their own module and reuse across several scripts.sub CheckFile { my $filename = shift; ... } sub CheckHost { my $host = shift; ... } sub CheckDB { my $db = shift; ... } ... my %checkList = ( DbName => \&CheckDB, configFile => \&CheckFile, iniFile => \&CheckFile, remoteHOST => \&CheckHost ); while (my($key,$value) = each %checkList) { &$value($key) or die "Check $key failed"; }
|
|---|