Add smartmatch support topic/smartmatch
authorYuval Kogman <nothingmuch@woobling.org>
Mon, 21 Sep 2009 18:35:54 +0000 (21:35 +0300)
committerYuval Kogman <nothingmuch@woobling.org>
Mon, 21 Sep 2009 18:35:54 +0000 (21:35 +0300)
commitf161acbecfc3cd06cfa3b42eae2d2c5a334cc1f6
tree8e2892462cd1048e16a34fc96c52d0d96d4b25b1
parentd06b3d22f2284f94e0cb2971b8049ee8cea39f3e
Add smartmatch support

Delegates to the `check` method of the type constraint, so that e.g.

    "foo" ~~ Str

returns true.

Unfortunately this doesn't actually work for when (Str) etc because that
checks if the return value of Str is true instead of whether $_ ~~ Str.
lib/MooseX/Types/TypeDecorator.pm
t/22_smartmatch.t [new file with mode: 0644]