Description
Galen Charlton
2014-04-28 15:21:42 UTC
unless ( $data ~~ @used_datas ) { Should be the same as unless ( grep ( $_ eq $data) @used_datas ) { (I think, just noting it down for when I get the chance to try it) (In reply to Chris Cormack from comment #1) > unless ( $data ~~ @used_datas ) { > > Should be the same as > > unless ( grep ( $_ eq $data) @used_datas ) { > > (I think, just noting it down for when I get the chance to try it) It should be unless ( grep { $_ eq $data } @used_datas ) { Created attachment 28580 [details] [review] Bug 12151: Remove uses of smartmatch operator in Search.pm and opac-search.pl This patch removes the use of smartmatch operators in the search code. Regards To+ Created attachment 28581 [details] [review] Bug 12151: Remove uses of smartmatch operator in report scripts This patch removes the use of smartmatch operators in report scripts. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Created attachment 28615 [details] [review] Bug 12151: Remove uses of smartmatch operator from Koha/Solr/QueryBuilder.pm Just that. Regards To+ Created attachment 28616 [details] [review] Bug 12151: Remove use of smartmatch operator in tools/batchMod.pl The '~~' smartmatch operator is used to compare MARC::Field->subfield(code) (i.e. a string) and the text element of each MARC::Field->subfields() which is also plain text. Substituting '~~' for 'eq' should be harmless then. Regards To+ Comment on attachment 28580 [details] [review] Bug 12151: Remove uses of smartmatch operator in Search.pm and opac-search.pl Review of attachment 28580 [details] [review]: ----------------------------------------------------------------- ::: C4/Search.pm @@ +533,4 @@ > foreach my $field (@fields) { > my $data = $field->as_string( $subfield_letters, $facet->{sep} ); > > + unless ( any { $data eq $_ } @used_datas ) { Why don't you use grep? unless( grep /^$date$/, @used_datas ) Should do the same without the List::MoreUtils deps. ::: opac/opac-search.pl @@ +358,4 @@ > @sort_by = $cgi->param('sort_by'); > $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); > foreach my $sort (@sort_by) { > + if ( any { $sort eq $_ } @allowed_sortby ) { Same here. (In reply to Jonathan Druart from comment #7) > Comment on attachment 28580 [details] [review] [review] > Bug 12151: Remove uses of smartmatch operator in Search.pm and opac-search.pl > > Review of attachment 28580 [details] [review] [review]: > ----------------------------------------------------------------- > > ::: C4/Search.pm > @@ +533,4 @@ > > foreach my $field (@fields) { > > my $data = $field->as_string( $subfield_letters, $facet->{sep} ); > > > > + unless ( any { $data eq $_ } @used_datas ) { > > Why don't you use grep? > unless( grep /^$date$/, @used_datas ) > > Should do the same without the List::MoreUtils deps. I was more used to the Lists::Moreutils which don't have much footprint, and was already used all over the project. Feel free to change it. Created attachment 29013 [details] [review] Bug 12151: Remove uses of smartmatch operator in Search.pm and opac-search.pl This patch removes the use of smartmatch operators in the search code. Regards To+ Edit: this revision uses 'grep' instead of Lists::MoreUtils::any Sponsored-by: Universidad Nacional de Cordoba Created attachment 29014 [details] [review] Bug 12151: Remove uses of smartmatch operator in report scripts This patch removes the use of smartmatch operators in report scripts. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Created attachment 29015 [details] [review] Bug 12151: Remove uses of smartmatch operator from Koha/Solr/QueryBuilder.pm Just that. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Created attachment 29016 [details] [review] Bug 12151: Remove use of smartmatch operator in tools/batchMod.pl The '~~' smartmatch operator is used to compare MARC::Field->subfield(code) (i.e. a string) and the text element of each MARC::Field->subfields() which is also plain text. Substituting '~~' for 'eq' should be harmless then. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Created attachment 29487 [details] [review] [SIGNED-OFF] Bug 12151: Remove uses of smartmatch operator in Search.pm and opac-search.pl This patch removes the use of smartmatch operators in the search code. Regards To+ Edit: this revision uses 'grep' instead of Lists::MoreUtils::any Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Passes koha-qa.pl, all affected scripts appear to work properly Created attachment 29488 [details] [review] [SIGNED-OFF] Bug 12151: Remove uses of smartmatch operator in report scripts This patch removes the use of smartmatch operators in report scripts. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 29489 [details] [review] [SIGNED-OFF] Bug 12151: Remove uses of smartmatch operator from Koha/Solr/QueryBuilder.pm Just that. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 29490 [details] [review] [SIGNED-OFF] Bug 12151: Remove use of smartmatch operator in tools/batchMod.pl The '~~' smartmatch operator is used to compare MARC::Field->subfield(code) (i.e. a string) and the text element of each MARC::Field->subfields() which is also plain text. Substituting '~~' for 'eq' should be harmless then. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 29519 [details] [review] [PASSED QA] Bug 12151: Remove uses of smartmatch operator in Search.pm and opac-search.pl This patch removes the use of smartmatch operators in the search code. Regards To+ Edit: this revision uses 'grep' instead of Lists::MoreUtils::any Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes all tests and QA script. Tested search, no problems found. Created attachment 29520 [details] [review] [PASSED QA] Bug 12151: Remove uses of smartmatch operator in report scripts This patch removes the use of smartmatch operators in report scripts. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes QA script and tests. Acquisition and Patron statistics wizard tested, no regressions found. Created attachment 29521 [details] [review] Bug 12151: Remove uses of smartmatch operator from Koha/Solr/QueryBuilder.pm Just that. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes QA script and tests. Could only verify by reading the code. Created attachment 29522 [details] [review] [PASSED QA] Bug 12151: Remove use of smartmatch operator in tools/batchMod.pl The '~~' smartmatch operator is used to compare MARC::Field->subfield(code) (i.e. a string) and the text element of each MARC::Field->subfields() which is also plain text. Substituting '~~' for 'eq' should be harmless then. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes QA script and tests. Tested batch modification of items, no problems found. Created attachment 29523 [details] [review] [PASSED QA] Bug 12151: Remove uses of smartmatch operator from Koha/Solr/QueryBuilder.pm Just that. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes QA script and tests. Could only verify by reading the code. Patches pushed to master. Please see Bug 12593 for fix of problem with facets and data with square brackets Pushed to 3.16.x for inclusion in 3.16.4. I choose to not push to 3.14.x I set as resolved |