[Koha-bugs] [Bug 23084] Replace grep {^$var$} with grep {$var eq $_}

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jun 24 17:57:20 CEST 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23084

--- Comment #8 from M. Tompsett <mtompset at hotmail.com> ---
Comment on attachment 90823
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=90823
Bug 23084: Replace grep {^$var$} with grep {$_ eq $var}

Review of attachment 90823:
 --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=23084&attachment=90823)
-----------------------------------------------------------------

These are the two places I will actually test, because everything else is a
easy eyeball by comparison.

::: opac/opac-memberentry.pl
@@ +77,4 @@
>  
>  my @libraries = Koha::Libraries->search;
>  if ( my @libraries_to_display = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList') ) {
> +    @libraries = map { my $b = $_; my $branchcode = $_->branchcode; grep { $_ eq $branchcode } @libraries_to_display ? $b : () } @libraries;

Super ugly code. There won't be scoping issues the $_?

::: opac/opac-search-history.pl
@@ +70,4 @@
>                  @searches = map { $_->{type} ne $type ? $_ : () } @searches;
>              }
>              if ( @id ) {
> +                @searches = map { my $search = $_; ( grep { $_ eq $search->{id} } @id ) ? () : $_ } @searches;

Super ugly code. Test for scoping issues.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list