From e45d0b6702d56ffeab512656c1f1b682c96e1ce8 Mon Sep 17 00:00:00 2001 From: doy Date: Sat, 6 Dec 2008 18:15:05 -0500 Subject: parameterized roles use 'method', not 'sub' --- lib/MooseX/Role/Matcher.pm | 28 ++++++++++++++-------------- 1 file 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; -} +}; }; -- cgit v1.2.3-54-g00ecf