add manual coverage & spelling tests. Fix spelling errors
[gitmo/MooseX-Types.git] / lib / MooseX / Types / TypeDecorator.pm
index a94c5c3..3eba05d 100644 (file)
@@ -1,15 +1,21 @@
 package MooseX::Types::TypeDecorator;
 
+#ABSTRACT: Wraps Moose::Meta::TypeConstraint objects with added features
+
 use strict;
 use warnings;
 
-
 use Carp::Clan qw( ^MooseX::Types );
 use Moose::Util::TypeConstraints ();
 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
@@ -45,10 +52,6 @@ use overload(
     
 );
 
-=head1 NAME
-
-MooseX::Types::TypeDecorator - More flexible access to a Type Constraint
-
 =head1 DESCRIPTION
 
 This is a decorator object that contains an underlying type constraint.  We use
@@ -180,7 +183,7 @@ sub DESTROY {
 
 =head2 AUTOLOAD
 
-Delegate to the decorator targe
+Delegate to the decorator target.
 
 =cut
 
@@ -194,7 +197,6 @@ sub AUTOLOAD {
     ## MooseX::Types::UndefinedType which AUTOLOADs during autovivication.
     
     my $return;
-    
     eval {
         $return = $self->__type_constraint->$method(@args);
     }; if($@) {
@@ -204,10 +206,6 @@ sub AUTOLOAD {
     }
 }
 
-=head1 AUTHOR
-
-See L<MooseX::Types/AUTHOR>.
-
 =head1 LICENSE
 
 This program is free software; you can redistribute it and/or modify