summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2008-12-05 23:09:45 -0500
committerdoy <doy@tozt.net>2008-12-05 23:09:45 -0500
commit680f01905cc044fbcb8d0465e02f5aa10160aaec (patch)
treee5e1674e6869fc7f89e6244bb9c1b153f3b5a79f
parent790844762eade061c7bb7854e2dc264202bad479 (diff)
downloadmoosex-role-matcher-680f01905cc044fbcb8d0465e02f5aa10160aaec.tar.gz
moosex-role-matcher-680f01905cc044fbcb8d0465e02f5aa10160aaec.zip
use the default if nothing else is passed in
-rw-r--r--lib/MooseX/Role/Searchable.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/MooseX/Role/Searchable.pm b/lib/MooseX/Role/Searchable.pm
index 8ea13e8..2a58a01 100644
--- a/lib/MooseX/Role/Searchable.pm
+++ b/lib/MooseX/Role/Searchable.pm
@@ -29,6 +29,10 @@ sub _apply_to_matches {
}
my $value = shift;
+ if (!defined($value)) {
+ # they passed in only one argument. assume they are checking identity
+ ($matcher, $value) = ($default, $matcher);
+ }
return $on_match->(sub { $code->($_) }, (grep { $_->match($matcher => $value) } @_));
}