From 32e65e451ffd044b61c17b2f620d1a8c802c4ee5 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 24 Aug 2009 15:37:00 +1200 Subject: [PATCH] Failing gracefully if Memoize::Memcached is not installed Signed-off-by: Galen Charlton --- C4/Languages.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/C4/Languages.pm b/C4/Languages.pm index 6bb9146447..971cc96ef4 100644 --- a/C4/Languages.pm +++ b/C4/Languages.pm @@ -2,7 +2,7 @@ package C4::Languages; # Copyright 2006 (C) LibLime # Joshua Ferraro -# +# Portions Copyright 2009 Chris Cormack and the Koha Dev Team # This file is part of Koha. # # Koha is free software; you can redistribute it and/or modify it under the @@ -25,17 +25,19 @@ use Carp; use C4::Context; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); - -use Memoize::Memcached - memcached => { +eval { + require Memoize::Memcached; + import Memoize::Memcached qw(memoize_memcached); + + my $memcached = { servers => [ C4::Context->config('memcached_servers') ], key_prefix => C4::Context->config('memcached_namespace'), - }; - -memoize_memcached('getTranslatedLanguages', expire_time => 600); #cache for 10 minutes -memoize_memcached('getFrameworkLanguages' , expire_time => 600); -memoize_memcached('getAllLanguages', expire_time => 600); + }; + memoize_memcached('getTranslatedLanguages', memcached => $memcached, expire_time => 600); #cache for 10 minutes + memoize_memcached('getFrameworkLanguages' , memcached => $memcached, expire_time => 600); + memoize_memcached('getAllLanguages', memcached => $memcached, expire_time => 600); +}; BEGIN { $VERSION = 3.00; -- 2.39.5