#!/usr/bin/perl -w # Backups Blow by Brandon Low# # Copyright 2007 Brandon Low # Released under the terms of the GPL v2 # # http://lostlogicx.com/backupsblow/ package BackupsBlow::Programs; use strict; use Exporter; our (@EXPORT_OK, %EXPORT_TAGS, @ISA); @ISA = qw(Exporter); @EXPORT_OK = qw(&program &needProgram); %EXPORT_TAGS = ("all" => [@EXPORT_OK]); use Log::Log4perl; my $logger=Log::Log4perl->get_logger(); sub program($) { chomp(my $retval=`which $_[0] 2> /dev/null`); return undef if ($retval =~ m/(.*not found.*|^$)/); return $retval; } sub needProgram($) { my $retval = program($_[0]); die("$_[0] not found in path") unless ($retval); return $retval; } 1;
"I have sworn upon the altar of God eternal hostility against every form of tyranny over the mind of man." --Thomas Jefferson