[icinga-checkins] icinga.org: icinga-core/fholzer/core: Add a simple which implementation

git at icinga.org git at icinga.org
Sat Apr 21 20:23:45 CEST 2012


Module: icinga-core
Branch: fholzer/core
Commit: d722dae0d58623023e6c72d8460f06dcc95e29cb
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=d722dae0d58623023e6c72d8460f06dcc95e29cb

Author: Alexander Wirt <formorer at debian.org>
Date:   Fri Apr 20 22:21:15 2012 +0200

Add a simple which implementation

---

 tools/icinga_verification.pl |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/tools/icinga_verification.pl b/tools/icinga_verification.pl
index 877353e..c4c8e10 100644
--- a/tools/icinga_verification.pl
+++ b/tools/icinga_verification.pl
@@ -26,11 +26,13 @@ use strict;
 use warnings;
 use DBI;
 use Term::ANSIColor;
-use Env qw (LANG);
+use Env qw (LANG PATH);
 use Getopt::Long;
 
 # sub stubs
 sub get_key_from_ini ($$);
+sub which($);
+
 ################################
 # Option parsing
 ################################
@@ -301,3 +303,9 @@ sub get_key_from_ini ($$) {
         }
 }
 
+
+sub which ($) {
+    my $binary = shift;
+    map { -x "$_/$binary" && return "$_/$binary" } reverse(split(':', $PATH));
+    return undef;
+}





More information about the icinga-checkins mailing list