From ff9259403dd8bc15cec81b7d12e92d2eeb980263 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 13 Nov 2015 14:34:31 +0000 Subject: [PATCH] Bug 15182: Continue to consider Crypt::GCrypt optional Caused by commit f25fe6ddb4a340f12613784dc841ab5bfd672d6b Date: Fri Nov 6 11:21:56 2015 -0300 Bug 15151: Avoid DB access to load C4::Members Make Koha::NorwegianPatronDB requires on loading C4::Members. But Koha::NorwegianPatronDB uses Crypt::GCrypt which is marked as optional in the deps list. This patch suggest to load the module only if it can be loaded and does not explode otherwise. Another solution would be to surround the require with an eval, to avoid to load Module::Load when C4::Members is used. Test plan: uninstall Crypt::GCrypt and try to access the staff interface. Without this patch, you will get a software error. --- C4/Members.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C4/Members.pm b/C4/Members.pm index 5f71e89..e0db026 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -41,7 +41,11 @@ use Koha::Borrower::Debarments qw(IsDebarred); use Text::Unaccent qw( unac_string ); use Koha::AuthUtils qw(hash_password); use Koha::Database; -require Koha::NorwegianPatronDB; + +use Module::Load::Conditional qw( can_load ); +if ( can_load( modules => { 'Koha::NorwegianPatronDB' => undef } ) ) { + load Koha::NorwegianPatronDB, qw( NLUpdateHashedPIN NLEncryptPIN NLSync ); +} our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug); -- 2.1.0