X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FTypes%2FTypeDecorator.pm;h=b95f12469a75f82ad63728d4d11bde6432666f3d;hb=6a1db9c7c89f006f6231aa64a9629dd1de7c5a15;hp=6e71c43adaa95a51b2ee63ec64eda3805fbd6236;hpb=cec62c799d89f62bf99abfd855c9fde397d7409b;p=gitmo%2FMooseX-Types.git diff --git a/lib/MooseX/Types/TypeDecorator.pm b/lib/MooseX/Types/TypeDecorator.pm index 6e71c43..b95f124 100644 --- a/lib/MooseX/Types/TypeDecorator.pm +++ b/lib/MooseX/Types/TypeDecorator.pm @@ -1,5 +1,5 @@ package MooseX::Types::TypeDecorator; -our $VERSION = "0.21"; +our $VERSION = "0.26"; 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 @@ -195,7 +201,6 @@ sub AUTOLOAD { ## MooseX::Types::UndefinedType which AUTOLOADs during autovivication. my $return; - eval { $return = $self->__type_constraint->$method(@args); }; if($@) {