projects
/
gitmo/Moose.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(parent:
2d211ef
)
added bool context overload to m:m:tc
John Napiorkowski [Tue, 1 Jun 2010 17:41:03 +0000 (13:41 -0400)]
lib/Moose/Meta/TypeConstraint.pm
patch
|
blob
|
blame
|
history
t/040_type_constraints/010_misc_type_tests.t
patch
|
blob
|
blame
|
history
diff --git
a/lib/Moose/Meta/TypeConstraint.pm
b/lib/Moose/Meta/TypeConstraint.pm
index
d292bcc
..
48c5ec4
100644
(file)
--- 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
(file)
--- 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;