Bugzilla – Attachment 28580 Details for
Bug 12151
remove remaining uses of the Perl smartmatch operator
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12151: Remove uses of smartmatch operator in Search.pm and opac-search.pl
Bug-12151-Remove-uses-of-smartmatch-operator-in-Se.patch (text/plain), 2.43 KB, created by
Tomás Cohen Arazi (tcohen)
on 2014-05-31 03:35:57 UTC
(
hide
)
Description:
Bug 12151: Remove uses of smartmatch operator in Search.pm and opac-search.pl
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2014-05-31 03:35:57 UTC
Size:
2.43 KB
patch
obsolete
>From 4fc20bc72eb23b146b2fe48fe34a221224facd36 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Fri, 30 May 2014 20:54:10 -0300 >Subject: [PATCH] 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+ >--- > C4/Search.pm | 3 ++- > opac/opac-search.pl | 16 +++++++--------- > 2 files changed, 9 insertions(+), 10 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 748bb1c..244c67a 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -34,6 +34,7 @@ use C4::Charset; > use YAML; > use URI::Escape; > use Business::ISBN; >+use List::MoreUtils qw/any/; > use MARC::Record; > use MARC::Field; > use utf8; >@@ -532,7 +533,7 @@ sub getRecords { > foreach my $field (@fields) { > my $data = $field->as_string( $subfield_letters, $facet->{sep} ); > >- unless ( $data ~~ @used_datas ) { >+ unless ( any { $data eq $_ } @used_datas ) { > push @used_datas, $data; > $facets_counter->{ $facet->{idx} }->{$data}++; > } >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 990cbd0..d1b2f93 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -30,15 +30,12 @@ use Modern::Perl; > use C4::Context; > > my $searchengine = C4::Context->preference("SearchEngine"); >-for ( $searchengine ) { >- when ( /^Solr$/ ) { >- warn "We use Solr"; >- require 'opac/search.pl'; >- exit; >- } >- when ( /^Zebra$/ ) { >+if ( $searchengine =~ /^Solr$/ ) { >+ warn "We use Solr"; >+ require 'opac/search.pl'; >+ exit; >+} elsif ( $searchengine =~ /^Zebra$/ ) { > >- } > } > > use C4::Output; >@@ -54,6 +51,7 @@ use C4::SocialData; > use C4::Ratings; > use C4::External::OverDrive; > >+use List::MoreUtils qw/any/; > use POSIX qw(ceil floor strftime); > use URI::Escape; > use JSON qw/decode_json encode_json/; >@@ -360,7 +358,7 @@ my @allowed_sortby = qw /acqdate_asc acqdate_dsc author_az author_za call_number > @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 ( $sort ~~ @allowed_sortby ) { >+ if ( any { $sort eq $_ } @allowed_sortby ) { > $template->param($sort => 1); > } > } >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12151
:
28580
|
28581
|
28615
|
28616
|
29013
|
29014
|
29015
|
29016
|
29487
|
29488
|
29489
|
29490
|
29519
|
29520
|
29521
|
29522
|
29523