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=fdfaf4dd1984ed1d299f13047251f30ee83bc4c6;hpb=12a9b8fe4f08bc0a7785831c34a27bb45f5bb8fb;p=gitmo%2FMooseX-Types.git diff --git a/lib/MooseX/Types/TypeDecorator.pm b/lib/MooseX/Types/TypeDecorator.pm index fdfaf4d..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.20"; +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($@) {