summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2008-12-06 22:58:45 -0500
committerdoy <doy@tozt.net>2008-12-06 22:58:45 -0500
commitcf5ced804a7ad2c8d101a72d44a0068e69b51fe4 (patch)
tree07986b35fc04f529c55c78b54aca90b2d7e8c192
parent2538b5c23b461f63b26dd48019ac896a3d16b0d9 (diff)
downloadmoosex-role-matcher-cf5ced804a7ad2c8d101a72d44a0068e69b51fe4.tar.gz
moosex-role-matcher-cf5ced804a7ad2c8d101a72d44a0068e69b51fe4.zip
clean up my confusion with @_ and $_
-rw-r--r--lib/MooseX/Role/Matcher.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/MooseX/Role/Matcher.pm b/lib/MooseX/Role/Matcher.pm
index 6456031..bfb658e 100644
--- a/lib/MooseX/Role/Matcher.pm
+++ b/lib/MooseX/Role/Matcher.pm
@@ -17,8 +17,9 @@ method _apply_to_matches => sub {
my $class = shift;
my $on_match = shift;
my @list = @{ shift() };
- unshift @_, $default if (@_ % 2 == 1);
- $on_match->(sub { $_->match(@_) }, @list);
+ my @matchers = @_;
+ unshift @matchers, $default if (@_ % 2 == 1);
+ $on_match->(sub { $_->match(@matchers) }, @list);
};
method first_match => sub {
@@ -34,7 +35,7 @@ method each_match => sub {
method grep_matches => sub {
my $class = shift;
- my $grep = sub { my $code = shift; grep { $code->($_) } @_ };
+ my $grep = sub { my $code = shift; grep { $code->() } @_ };
$class->_apply_to_matches($grep, @_);
};