Skip to content

Commit

Permalink
more smart matching
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 4, 2012
1 parent 860f0af commit 33a16d1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/Mojo/Home.pm
Expand Up @@ -10,7 +10,6 @@ use File::Basename 'dirname';
use File::Find 'find';
use File::Spec::Functions qw(abs2rel catdir catfile splitdir);
use FindBin;
use List::Util 'first';
use Mojo::Asset::File;
use Mojo::Command;
use Mojo::Loader;
Expand Down Expand Up @@ -85,7 +84,7 @@ sub list_files {
find {
wanted => sub {
my @parts = splitdir(abs2rel($File::Find::name, $dir));
push @files, join '/', @parts unless first {/^\./} @parts;
push @files, join '/', @parts unless /^\./ ~~ \@parts;
},
no_chdir => 1
}, $dir;
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojolicious/Plugin/TagHelpers.pm
@@ -1,7 +1,6 @@
package Mojolicious::Plugin::TagHelpers;
use Mojo::Base 'Mojolicious::Plugin';

use List::Util 'first';
use Mojo::ByteStream 'b';
use Mojo::Util 'xml_escape';

Expand Down Expand Up @@ -242,7 +241,7 @@ sub _input {
my $value = $attrs{value} // '';
if ($type eq 'checkbox' || $type eq 'radio') {
$attrs{value} = $value;
$attrs{checked} = 'checked' if defined first { $value eq $_ } @values;
$attrs{checked} = 'checked' if $value ~~ \@values;
}

# Others
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojolicious/Routes/Match.pm
@@ -1,7 +1,6 @@
package Mojolicious::Routes::Match;
use Mojo::Base -base;

use List::Util 'first';
use Mojo::Util qw(decode url_unescape);

has captures => sub { {} };
Expand Down Expand Up @@ -40,7 +39,7 @@ sub match {
# Method
if (my $methods = $r->via) {
my $method = $self->{method} eq 'HEAD' ? 'GET' : $self->{method};
return unless first { $method eq $_ } @$methods;
return unless $method ~~ $methods;
}

# Conditions
Expand Down

0 comments on commit 33a16d1

Please sign in to comment.