[check_postgres] [commit] Quick fix to remove the 'use' of Data::Parse for the whole script.

check_postgres at bucardo.org check_postgres at bucardo.org
Wed Feb 4 15:42:09 UTC 2009


Committed by Greg Sabino Mullane <greg at endpoint.com>

Quick fix to remove the 'use' of Data::Parse for the whole script.

---
 check_postgres.pl |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/check_postgres.pl b/check_postgres.pl
index 81586b2..ae2c929 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -3749,7 +3749,13 @@ sub check_checkpoint {
 	my $last = $1;
 
 	## Convert to number of seconds
-	use Date::Parse;
+	eval {
+		require Date::Parse;
+		import Date::Parse;
+	};
+	if ($@) {
+		ndie "Must install the Perl module 'Date::Parse' to use the checkpoint action";
+	}
 	my $dt = str2time($last);
 	if ($dt !~ /^\d+$/) {
 		ndie qq{Unable to parse pg_controldata output: "$last"\n};
-- 
1.6.0.5



More information about the Check_postgres mailing list