From 6786a9cdc554e8ff449e7fa9e079939fee0b7a59 Mon Sep 17 00:00:00 2001 From: doy Date: Sun, 7 Dec 2008 01:29:07 -0500 Subject: document match --- lib/MooseX/Role/Matcher.pm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/lib/MooseX/Role/Matcher.pm b/lib/MooseX/Role/Matcher.pm index e4b1073..7225a97 100644 --- a/lib/MooseX/Role/Matcher.pm +++ b/lib/MooseX/Role/Matcher.pm @@ -154,6 +154,43 @@ method _match => sub { =method match +This method provides the majority of the functionality of this role. It accepts +a hash of arguments, with keys being the methods (usually attributes) of the +object to be tested, and values being things to test against them. Possible +types of values are: + +=over + +=item SCALAR + +Returns true if the result of the method is equal to (C) the value of the +scalar, otherwise returns false. + +=item REGEXP + +Returns true if the result of the method matches the regexp, otherwise returns +false. + +=item CODEREF + +Calls the coderef with $_ set to the result of the method, returning true if +the coderef returns true, and false otherwise. + +=item UNDEF + +Returns true if the method returns undef, or if the object doesn't have a +method by this name, otherwise returns false. + +=item ARRAYREF + +Matches the result of the method against each element in the arrayref as +described above, returning true if any of the submatches return true, and false +otherwise. + +=back + +Method names can also be given with a leading '!', which inverts that test. The first key can be omitted from the argument list if it is the method name passed to the default_match parameter when composing this role. + =cut method match => sub { -- cgit v1.2.3