diff options
author | doy <doy@tozt.net> | 2008-12-05 23:09:45 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2008-12-05 23:09:45 -0500 |
commit | 680f01905cc044fbcb8d0465e02f5aa10160aaec (patch) | |
tree | e5e1674e6869fc7f89e6244bb9c1b153f3b5a79f /lib/MooseX/Role/Searchable.pm | |
parent | 790844762eade061c7bb7854e2dc264202bad479 (diff) | |
download | moosex-role-matcher-680f01905cc044fbcb8d0465e02f5aa10160aaec.tar.gz moosex-role-matcher-680f01905cc044fbcb8d0465e02f5aa10160aaec.zip |
use the default if nothing else is passed in
Diffstat (limited to 'lib/MooseX/Role/Searchable.pm')
-rw-r--r-- | lib/MooseX/Role/Searchable.pm | 4 |
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) } @_)); } |