diff options
author | doy <doy@tozt.net> | 2008-12-06 18:15:05 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2008-12-06 18:15:05 -0500 |
commit | e45d0b6702d56ffeab512656c1f1b682c96e1ce8 (patch) | |
tree | 1aa1d680ee1586cbbd63d54602f9473fa8aca2e4 /lib/MooseX/Role/Matcher.pm | |
parent | b80717a19cef100aeef9ccd21a2ae10aa0d7b002 (diff) | |
download | moosex-role-matcher-e45d0b6702d56ffeab512656c1f1b682c96e1ce8.tar.gz moosex-role-matcher-e45d0b6702d56ffeab512656c1f1b682c96e1ce8.zip |
parameterized roles use 'method', not 'sub'
Diffstat (limited to 'lib/MooseX/Role/Matcher.pm')
-rw-r--r-- | lib/MooseX/Role/Matcher.pm | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/MooseX/Role/Matcher.pm b/lib/MooseX/Role/Matcher.pm index 1632ba5..ba77e07 100644 --- a/lib/MooseX/Role/Matcher.pm +++ b/lib/MooseX/Role/Matcher.pm @@ -13,7 +13,7 @@ role { my $p = shift; my $default = $p->default_match; -sub _apply_to_matches { +method _apply_to_matches => sub { my $on_match = shift; my $code = shift; my $matcher = shift; @@ -35,26 +35,26 @@ sub _apply_to_matches { } return $on_match->(sub { $code->($_) }, (grep { $_->match($matcher => $value) } @_)); -} +}; -sub first_match { +method first_match => sub { _apply_to_matches(\&first, @_); -} +}; -sub each_match { +method each_match => sub { _apply_to_matches(\&apply, @_); -} +}; -sub grep_matches { +method grep_matches => sub { # XXX: can you use grep like this? _apply_to_matches(\&grep, @_); -} +}; -sub any_match { +method any_match => sub { _apply_to_matches(\&any, @_); -} +}; -sub _match { +method _match => sub { my $self = shift; my $value = shift; my $seek = shift; @@ -69,9 +69,9 @@ sub _match { } } return $value eq $seek; -} +}; -sub match { +method match => sub { my $self = shift; my %args = @_; @@ -93,7 +93,7 @@ sub match { } return 1; -} +}; }; |