Bug 11921: (QA followup) Remove remaining unused var
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 7 Sep 2016 14:37:24 +0000 (11:37 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 8 Sep 2016 10:29:00 +0000 (10:29 +0000)
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 <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Context.pm
Koha/Cache.pm
Koha/Caches.pm
Koha/Config.pm

index d6a31bf..4f7aeac 100644 (file)
@@ -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 <http://www.gnu.org/licenses>.
 
-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;
index be12512..b966373 100644 (file)
@@ -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:";
 
index 808b392..52f1812 100644 (file)
@@ -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 <http://www.gnu.org/licenses>.
+
 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};
 }
 
index cef87ec..117c404 100644 (file)
@@ -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 <http://www.gnu.org/licenses>.
+
 use Modern::Perl;
+
 use XML::Simple;
 
 # Default config file, if none is specified