X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FTypes%2FTypeDecorator.pm;h=de5660244952e8c328d5b3c0db50f5fad7905740;hb=6d7f2c07382702d3807060253671ac8572c7e33e;hp=a94c5c34656cb227eb69541ad89d8c2dab85b56c;hpb=b55332a8c759716048630d99e936c3817d68de73;p=gitmo%2FMooseX-Types.git diff --git a/lib/MooseX/Types/TypeDecorator.pm b/lib/MooseX/Types/TypeDecorator.pm index a94c5c3..de56602 100644 --- a/lib/MooseX/Types/TypeDecorator.pm +++ b/lib/MooseX/Types/TypeDecorator.pm @@ -1,4 +1,5 @@ package MooseX::Types::TypeDecorator; +our $VERSION = "0.22"; use strict; use warnings; @@ -10,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) { @@ -18,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