Rev 7 | Blame | Last modification | View Log | Download | RSS feed
#!/usr/bin/env perl
use warnings;
$main::VERSION = '1.0';
# set of libraries to be used by these modules
# cleanUp - passed a delimiter and a string, does the following (delimiter can be '')
# chomps the string (removes trailing newlines)
# removes all text BEFORE the delimiter, the delimiter, and any whitespace
# thus, the string 'xxI Am x a weird string' with a newline will become
# 'a weird string' with no newline
sub cleanUp {
my ($delimiter, $text) = @_;
chomp $text;
return $text unless $delimiter;
$text =~ m/[^$delimiter]*$delimiter\s*(.*)/;
return $1;
}
# checks if a command is valid on this system. If so, returns the full path to it
# else, returns empty string.
sub validCommandOnSystem {
my $command = shift;
$command = `which $command 2> /dev/null`;
chomp $command;
return -x $command ? $command : '';
}
1;