From 1ebb3c386631359c5265a2bd31503c97bf2c4982 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 7 Sep 2016 11:37:24 -0300 Subject: [PATCH] Bug 11921: (QA followup) Remove remaining unused var This patch removes an occurence of an unused var in Context.pm and also prevents a warning if memcached_servers is not set: Use of uninitialized value in split at /home/vagrant/kohaclone/Koha/Cache.pm line 91. t also tidies small things. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall --- C4/Context.pm | 7 ++++--- Koha/Cache.pm | 3 ++- Koha/Caches.pm | 19 ++++++++++++++++++- Koha/Config.pm | 16 ++++++++++++++++ 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/C4/Context.pm b/C4/Context.pm index d6a31bf002..4f7aeac23e 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -1,4 +1,5 @@ package C4::Context; + # Copyright 2002 Katipo Communications # # This file is part of Koha. @@ -16,9 +17,9 @@ package C4::Context; # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; -use vars qw($AUTOLOAD $context @context_stack $servers); +use Modern::Perl; + +use vars qw($AUTOLOAD $context @context_stack); BEGIN { if ($ENV{'HTTP_USER_AGENT'}) { require CGI::Carp; diff --git a/Koha/Cache.pm b/Koha/Cache.pm index be12512a5d..b96637317a 100644 --- a/Koha/Cache.pm +++ b/Koha/Cache.pm @@ -88,7 +88,8 @@ sub new { unless ( $self->{namespace} and @servers ) { my $koha_config = Koha::Config->read_from_file( Koha::Config->guess_koha_conf() ); $self->{namespace} ||= $koha_config->{config}{memcached_namespace} || 'koha'; - @servers = split /,/, $koha_config->{config}{memcached_servers} unless @servers; + @servers = split /,/, $koha_config->{config}{memcached_servers} // '' + unless @servers; } $self->{namespace} .= ":$subnamespace:"; diff --git a/Koha/Caches.pm b/Koha/Caches.pm index 808b392a90..52f181226f 100644 --- a/Koha/Caches.pm +++ b/Koha/Caches.pm @@ -1,13 +1,30 @@ package Koha::Caches; +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + use Modern::Perl; + use Koha::Cache; our $singleton_caches; sub get_instance { my ($class, $subnamespace) = @_; $subnamespace //= ''; - $singleton_caches->{$subnamespace} = Koha::Cache->new({}, { subnamespace => $subnamespace } ) unless $singleton_caches->{$subnamespace}; + $singleton_caches->{$subnamespace} = Koha::Cache->new({}, { subnamespace => $subnamespace } ) + unless $singleton_caches->{$subnamespace}; return $singleton_caches->{$subnamespace}; } diff --git a/Koha/Config.pm b/Koha/Config.pm index cef87ece6d..117c404ead 100644 --- a/Koha/Config.pm +++ b/Koha/Config.pm @@ -1,6 +1,22 @@ package Koha::Config; +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + use Modern::Perl; + use XML::Simple; # Default config file, if none is specified -- 2.39.5