diff options
author | Dirk von Suchodoletz | 2008-12-17 17:04:54 +0100 |
---|---|---|
committer | Dirk von Suchodoletz | 2008-12-17 17:04:54 +0100 |
commit | 707eb1cdaef84318f7a464fef94fff26d09d2514 (patch) | |
tree | 827d85efbc4851e159870f31a37be0374a700cff /lib/OpenSLX/Utils.pm | |
parent | Adding missing libraries as reported on the list. (diff) | |
download | core-707eb1cdaef84318f7a464fef94fff26d09d2514.tar.gz core-707eb1cdaef84318f7a464fef94fff26d09d2514.tar.xz core-707eb1cdaef84318f7a464fef94fff26d09d2514.zip |
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
Diffstat (limited to 'lib/OpenSLX/Utils.pm')
-rw-r--r-- | lib/OpenSLX/Utils.pm | 30 |
1 files changed, 30 insertions, 0 deletions
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<pathOf()> + +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<isInpath()> + +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; |