From 160dfcd2b16c0f999c281d737a8f218f4860f974 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Sat, 5 Feb 2011 18:05:42 -0700 Subject: [PATCH] Check for JSON::PP since Perl doesn't do it at compile-time, instead it fatals when needed. --- modules/Calc.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/Calc.pm b/modules/Calc.pm index 7872a57..90c9d42 100644 --- a/modules/Calc.pm +++ b/modules/Calc.pm @@ -13,6 +13,11 @@ use JSON -support_by_pp; # Initialization subroutine. sub _init { + # Check for JSON::PP. + eval { + require JSON::PP; + 1; + } or return 0; # Create the CALC command. cmd_add("CALC", 0, 0, \%m_Calc::HELP_CALC, \&m_Calc::calc) or return 0; @@ -115,8 +120,8 @@ Google Calculator. =over -This module requires LWP::UserAgent, URI::Escape and JSON. All are -obtainable from the CPAN . +This module requires LWP::UserAgent, URI::Escape and JSON/JSON::PP. +All are obtainable from the CPAN . This module is compatible with Auto version 3.0.0a2+.