From 680f01905cc044fbcb8d0465e02f5aa10160aaec Mon Sep 17 00:00:00 2001 From: doy Date: Fri, 5 Dec 2008 23:09:45 -0500 Subject: use the default if nothing else is passed in --- lib/MooseX/Role/Searchable.pm | 4 ++++ 1 file changed, 4 insertions(+) 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) } @_)); } -- cgit v1.2.3-54-g00ecf