summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2008-12-07 01:29:07 -0500
committerdoy <doy@tozt.net>2008-12-07 01:29:07 -0500
commit6786a9cdc554e8ff449e7fa9e079939fee0b7a59 (patch)
tree591e75f48e097fbde789613ce1d0bfc09ff4ea01
parenta1a08c4341a0aa255eb33f1a75687621b9eefaa7 (diff)
downloadmoosex-role-matcher-6786a9cdc554e8ff449e7fa9e079939fee0b7a59.tar.gz
moosex-role-matcher-6786a9cdc554e8ff449e7fa9e079939fee0b7a59.zip
document match
-rw-r--r--lib/MooseX/Role/Matcher.pm37
1 files changed, 37 insertions, 0 deletions
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<eq>) 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 {