Bug 16455: Remove the "Too late to run INIT block" from C4::Tags
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 5 May 2016 15:58:06 +0000 (16:58 +0100)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Mon, 6 Jun 2016 17:35:58 +0000 (17:35 +0000)
commit7d916c380a03904c47035f189d1ee666f00d9a11
tree5764d35f569f680845c0a6c0caa02926715d65c7
parentf2fe433cf9afce98957826bf2ade457557fe4eff
Bug 16455: Remove the "Too late to run INIT block" from C4::Tags

The pref TagsExternalDictionary is used to tell Lingua::Ispell to use an
other dictionary, different from the default one (/usr/bin/ispell).

To do so we need to set $Lingua::Ispell::path to the expected path.
It's currently done in the INIT block.

If you try to use C4::Tags, you will get the famous "Too late to run
INIT block at C4/Tags.pm line 74." warning. Plack use the INIT block to
load functions at run time, when we are using C4::Tags when hitting a pl
script, the compilation phase is finished and it's "too late to run INIT
block" from C4::Tags.

I do not really know if it has an impact on the behavior of
Lingua::Ispell (i.e. is the path redefined?), but I know that this INIT
block is not executed when we want.

Test plan:
under Plack,
- hit /cgi-bin/koha/opac-search.pl and confirm that the warning does no
longer appears
- Use another dictionnary (??), fill TagsExternalDictionary with its
  path and confirm that it is used by the tags approval system

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
C4/Tags.pm