Since bug 11998, the following warnings are raised: Name "Tie::Hash::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. Name "Cache::RemovalStrategy::LRU::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. Name "Cache::RemovalStrategy::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. It comes from the Koha::Cache 103 if ( can_load( modules => { 'Cache::Memory' => undef } ) ) {
Created attachment 49314 [details] [review] Bug 16104: Remove warnings "used only once: possible typo" Since bug 11998, the following warnings are raised: Name "Tie::Hash::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. Name "Cache::RemovalStrategy::LRU::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. Name "Cache::RemovalStrategy::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. It comes from the Koha::Cache 103 if ( can_load( modules => { 'Cache::Memory' => undef } ) ) { Test plan: perl -wc C4/AuthoritiesMarc.pm should return green QA note: this may have an impact on performance but I have not found any other workarounds.
*** Bug 16101 has been marked as a duplicate of this bug. ***
Created attachment 49325 [details] [review] Bug 16104: Remove warnings "used only once: possible typo" Since bug 11998, the following warnings are raised: Name "Tie::Hash::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. Name "Cache::RemovalStrategy::LRU::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. Name "Cache::RemovalStrategy::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. It comes from the Koha::Cache 103 if ( can_load( modules => { 'Cache::Memory' => undef } ) ) { Test plan: perl -wc C4/AuthoritiesMarc.pm should return green QA note: this may have an impact on performance but I have not found any other workarounds. NOTE: I applied 15870 to master, got the error (-v 2 -c 5), applied 16104, rebased it in front, error disappeared (still only -c 5), rebased it at the end, and signed off 16104. Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Also did an: 1) apply patch 2) perl -cw C4/AuthoritiesMarc.pm -- no issues 3) checked out master 4) repeat step 2 -- expected failures.
Created attachment 49827 [details] [review] [PASSED QA] Bug 16104: Remove warnings "used only once: possible typo" Since bug 11998, the following warnings are raised: Name "Tie::Hash::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. Name "Cache::RemovalStrategy::LRU::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. Name "Cache::RemovalStrategy::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. It comes from the Koha::Cache 103 if ( can_load( modules => { 'Cache::Memory' => undef } ) ) { Test plan: perl -wc C4/AuthoritiesMarc.pm should return green QA note: this may have an impact on performance but I have not found any other workarounds. NOTE: I applied 15870 to master, got the error (-v 2 -c 5), applied 16104, rebased it in front, error disappeared (still only -c 5), rebased it at the end, and signed off 16104. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to Master - Should be in the May 2016 Release. Thanks!
Patch pushed to 3.22.x, will be in 3.22.6
(In reply to Jonathan Druart from comment #1) > QA note: this may have an impact on performance but I have not found any > other workarounds. This if ( can_load( modules => { 'Cache::Memory' => undef, nocache => 1 } ) ) { is not a right syntax for 'noncache' parameter.. If called that way, can_load() tries to load Cache::Memory and (nonexisting) 'nocache' module (version >= 1.0), and fails - so it simply prevents Cache::Memory loading (hence no more warnings). This has and enormous impact on performance in all setups which do not use memcached as a caching system; after that, memchached is the only caching system still working in Koha. It also causes 'prove t/Cache.t' to fail in the default setup (w/o memcached).
I found another workaround: +can_load( modules => { 'Cache::Memory' => undef } ) && Cache::Memory->new(); our %L1_cache; - if ( can_load( modules => { 'Cache::Memory' => undef, nocache => 1 } ) ) { + if ( can_load( modules => { 'Cache::Memory' => undef } ) ) { which seems to work (?, "perl -wc C4/AuthoritiesMarc.pm" does not emit any warnings) without introducing noticeable performance issues, but I have no idea how exactly/why it works.. I have a feeling that it only hides the problem (whatever it really is) instead of fixing it properly.
(In reply to Jacek Ablewicz from comment #8) > This > > if ( can_load( modules => { 'Cache::Memory' => undef, nocache => 1 } ) ) { > > is not a right syntax for 'noncache' parameter.. If called that way, > can_load() tries to load Cache::Memory and (nonexisting) 'nocache' module > (version >= 1.0), and fails - so it simply prevents Cache::Memory loading > (hence no more warnings). This has and enormous impact on performance in all > setups which do not use memcached as a caching system; after that, > memchached is the only caching system still working in Koha. Erk! You are right, I misread the doc :-/ @RM please revert this patch
(In reply to Jonathan Druart from comment #10) > @RM please revert this patch ping! Above all, it fails 2 tests in t/db_dependent/Context.t
(In reply to Jonathan Druart from comment #11) > (In reply to Jonathan Druart from comment #10) > > @RM please revert this patch > > ping! > > Above all, it fails 2 tests in t/db_dependent/Context.t And t/db_dependent/sysprefs.t
Patch reverted in 3.22.x
Created attachment 51087 [details] [review] Revert "Bug 16104: Remove warnings "used only once: possible typo"" This reverts commit 6b319a2d487257e8a08bc26af9c6b2e7fa2ece2c.
Created attachment 51088 [details] [review] Revert "Bug 16104: Remove warnings "used only once: possible typo"" This reverts commit 6b319a2d487257e8a08bc26af9c6b2e7fa2ece2c. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Tested with memcached and without MEMCACHED_SERVERS. Cache.t, Context.t and sysprefs.t pass now.
Revert pushed to master
Revert will be in 3.22.7
If you compile (perl -cw) a script or module now that contains a use C4::Context, you have the following warnings: Name "Tie::Hash::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. Name "Cache::RemovalStrategy::LRU::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. Name "Cache::RemovalStrategy::FIELDS" used only once: possible typo at /usr/share/perl/5.22/fields.pm line 135. [ PS koha-qa does the same. ] Are these warnings somehow related to perl's Cache module containing things like below? use base qw(Tie::Hash); my $strategy = $args->{removal_strategy} || 'Cache::RemovalStrategy::LRU';
(In reply to Marcel de Rooy from comment #18) > If you compile (perl -cw) a script or module now that contains a use > C4::Context, you have the following warnings: > > Name "Tie::Hash::FIELDS" used only once: possible typo at > /usr/share/perl/5.22/fields.pm line 135. > Name "Cache::RemovalStrategy::LRU::FIELDS" used only once: possible typo at > /usr/share/perl/5.22/fields.pm line 135. > Name "Cache::RemovalStrategy::FIELDS" used only once: possible typo > at /usr/share/perl/5.22/fields.pm line 135. > > [ PS koha-qa does the same. ] > > Are these warnings somehow related to perl's Cache module containing things > like below? > > use base qw(Tie::Hash); > > my $strategy = $args->{removal_strategy} || 'Cache::RemovalStrategy::LRU'; Yes, more or less, but I have never managed to track down completely the problem. There is something weird happening... To recreate easily, see bug 11998 comment 62
Hm, this has been reverted - changing status.
FYI I have added a temporary fix to the qa tools commit d73431289d4c72d7751b006137f518851d2ee605 Do not consider "used only once: possible typo" as a warning (and make the tests pass!)
*** Bug 17238 has been marked as a duplicate of this bug. ***
History here is a little confusing and I am not sure how to test if these warning still occur. Is this still valid?