Version 0.22
[gitmo/MooseX-Types.git] / lib / MooseX / Types / TypeDecorator.pm
index fdfaf4d..de56602 100644 (file)
@@ -1,5 +1,5 @@
 package MooseX::Types::TypeDecorator;
-our $VERSION = "0.20";
+our $VERSION = "0.22";
 
 use strict;
 use warnings;
@@ -11,6 +11,11 @@ use Moose::Meta::TypeConstraint::Union;
 use Scalar::Util qw(blessed);
 
 use overload(
+    '0+' => sub {
+            my $self = shift @_;
+            my $tc = $self->{__type_constraint};
+            return 0+$tc;
+     },
     '""' => sub {
                my $self = shift @_;
                if(blessed $self) {
@@ -19,6 +24,7 @@ use overload(
                        return "$self";
                }
     },
+    bool => sub { 1 },
     '|' => sub {
         
         ## It's kind of ugly that we need to know about Union Types, but this