Skip to content

Commit

Permalink
Replace smartmatch with List::Util::first.
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Jun 5, 2013
1 parent aa0ffd4 commit bb21a34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
Expand Up @@ -4,6 +4,8 @@ Revision history for Perl extension PGXN::Site
- Distribution links in the user page now include the version, so that
it links to the latest version of the distribution released by the
user, rather than the latest released by any user.
- Replaced use of the smartmatch operator with List::Util::first so as
to eliminate deprecation warnings from Perl 5.18.

0.10.1 2012-12-12T07:31:22Z
- Added an Nginx configuration example to the mirroring page.
Expand Down
6 changes: 4 additions & 2 deletions lib/PGXN/Site/Controller.pm
Expand Up @@ -10,6 +10,7 @@ use PGXN::Site::Templates;
use HTML::TagCloud;
use Encode;
use WWW::PGXN;
use List::Util qw(first);
use namespace::autoclean;
our $VERSION = v0.10.2;

Expand Down Expand Up @@ -240,7 +241,7 @@ sub search {
my $params = $req->query_parameters;
my $q = $params->{q};

if ($q ~~ [undef, '', '*', '?']) {
if (first { $q eq $_ } (undef, '', '*', '?')) {
# Just redirect if there is no search term.
unless ($q) {
my $ref = '/';
Expand All @@ -258,7 +259,8 @@ sub search {
});
}

unless ($params->{in} ~~ [qw(docs dists extensions users tags)]) {
my $in = $params->{in};
unless (first { $in eq $_ } qw(docs dists extensions users tags)) {
return $self->render('/badrequest', {
env => $env,
code => $code_for{badrequest},
Expand Down

0 comments on commit bb21a34

Please sign in to comment.