From: John Napiorkowski Date: Tue, 1 Jun 2010 17:41:03 +0000 (-0400) Subject: added bool context overload to m:m:tc X-Git-Tag: 1.06~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=72e389bf23534deb3a5294043da17ca1f07eb1ed;p=gitmo%2FMoose.git added bool context overload to m:m:tc --- diff --git a/lib/Moose/Meta/TypeConstraint.pm b/lib/Moose/Meta/TypeConstraint.pm index d292bcc..48c5ec4 100644 --- a/lib/Moose/Meta/TypeConstraint.pm +++ b/lib/Moose/Meta/TypeConstraint.pm @@ -7,6 +7,7 @@ use metaclass; use overload '0+' => sub { refaddr(shift) }, # id an object '""' => sub { shift->name }, # stringify to tc name + bool => sub { 1 }, fallback => 1; use Scalar::Util qw(blessed refaddr); diff --git a/t/040_type_constraints/010_misc_type_tests.t b/t/040_type_constraints/010_misc_type_tests.t index 6915ddf..7b86046 100644 --- a/t/040_type_constraints/010_misc_type_tests.t +++ b/t/040_type_constraints/010_misc_type_tests.t @@ -84,4 +84,6 @@ ok $subtype2 => 'made a subtype of our subtype'; ok( 0+$foo == refaddr($foo), "overloading works"); } +ok $subtype1, "type constraint boolean overload works"; + done_testing;