From 7b16f055b68c8688e585324209f03f919b7d3227 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Wed, 1 Jun 2016 20:43:41 -0400 Subject: [PATCH] Bug 16637: t/00-load.t warning from C4/Tags.pm Added optional dependency, so as to explain why testing explodes when the Enhanced Content system preference TagsExternalDictionary is set. Since INIT runs after BEGIN, moved INIT logic into BEGIN in order to remove INIT and thus eliminate the warning. TEST PLAN --------- 1) prove t/00-load.t -- warning about INIT for C4::Tags 2) prove `git grep -l Tags | grep [.]t$` -- should all run okay 3) apply patch 4) repeat steps 1 and 2 -- warning should be gone, and everything else run okay 5) run koha qa test tools --- C4/Installer/PerlDependencies.pm | 5 +++++ C4/Tags.pm | 15 ++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index d84b51c..eded225 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -802,6 +802,11 @@ our $PERL_DEPS = { 'required' => '1', 'min_ver' => '0.14', }, + 'Lingua::Ispell' => { + 'usage' => 'Enhanced Content - Tagging', + 'required' => '0', + 'min_ver' => '0.07' + }, }; 1; diff --git a/C4/Tags.pm b/C4/Tags.pm index 09afd78..9d5b4be 100644 --- a/C4/Tags.pm +++ b/C4/Tags.pm @@ -56,10 +56,12 @@ BEGIN { import Data::Dumper qw(:DEFAULT); print STDERR __PACKAGE__ . " external dictionary = " . ($ext_dict||'none') . "\n"; } - if ($ext_dict) { - require Lingua::Ispell; - import Lingua::Ispell qw(spellcheck add_word_lc save_dictionary); - } + if ($ext_dict) { + require Lingua::Ispell; + import Lingua::Ispell qw(spellcheck add_word_lc save_dictionary); + $ext_dict and $Lingua::Ispell::path = $ext_dict; + $debug and print STDERR "\$Lingua::Ispell::path = $Lingua::Ispell::path\n"; + } } =head1 C4::Tags.pm - Support for user tagging of biblios. @@ -68,11 +70,6 @@ More verose debugging messages are sent in the presence of non-zero $ENV{"DEBUG" =cut -INIT { - $ext_dict and $Lingua::Ispell::path = $ext_dict; - $debug and print STDERR "\$Lingua::Ispell::path = $Lingua::Ispell::path\n"; -} - sub get_filters { my $query = "SELECT * FROM tags_filters "; my ($sth); -- 2.1.4