From 707eb1cdaef84318f7a464fef94fff26d09d2514 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Wed, 17 Dec 2008 16:04:54 +0000 Subject: More general location of helper functions (to check if a certain binary is installed somewhere). git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2426 95ad53e4-c205-0410-b2fa-d234c58c8868 --- lib/OpenSLX/Utils.pm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'lib/OpenSLX/Utils.pm') diff --git a/lib/OpenSLX/Utils.pm b/lib/OpenSLX/Utils.pm index b85d6bc1..dbc35270 100644 --- a/lib/OpenSLX/Utils.pm +++ b/lib/OpenSLX/Utils.pm @@ -658,4 +658,34 @@ sub grabLock return $lock; } +=item B + +Returns the path of a binary it is installed in. + +=cut + +sub pathOf +{ + my $self = shift; + my $binary = shift; + + return qx{which $binary 2>/dev/null}; +} + +=item B + +Returns whether a binary is found. + +=cut + +sub isInPath +{ + my $self = shift; + my $binary = shift; + + my $path = $self->pathOf($binary); + + return $path ? 1 : 0; +} + 1; -- cgit v1.2.3-55-g7522