incremented version and updated changelog, fixed bug that created extra coercions...
[gitmo/MooseX-Types.git] / t / lib / DecoratorLibrary.pm
index 6ded368..9eee6ff 100644 (file)
@@ -1,8 +1,5 @@
 package DecoratorLibrary;
 
-use warnings;
-use strict;
-
 use MooseX::Types::Moose qw( Str ArrayRef HashRef Int );
 use MooseX::Types
     -declare => [qw(
@@ -15,6 +12,21 @@ use MooseX::Types
         AtLeastOneInt
     )];
 
+## Some questionable messing around
+    sub my_subtype {
+        my ($subtype, $basetype, @rest) = @_;
+        return subtype($subtype, $basetype, shift @rest, shift @rest);
+    }
+    
+    sub my_from {
+        return @_;
+        
+    }
+    sub my_as {
+        return @_;
+    }
+## End
+
 subtype MyArrayRefBase,
     as ArrayRef;
     
@@ -48,17 +60,19 @@ coerce MyArrayRefInt02,
     from MyHashRefOfStr,
     via {[ sort map { length $_ } values(%$_) ]},
     ## Can't do HashRef[ArrayRef] here since if I do HashRef get the via {}
-    ## Stuff passed as args.  
-    from HashRef([ArrayRef]),
+    ## Stuff passed as args and the associated prototype messed with it.  MST
+    ## seems to have a line on it but might not fix fixable.
+    from (HashRef[ArrayRef]),
     via {[ sort map { @$_ } values(%$_) ]};
 
 subtype StrOrArrayRef,
     as Str|ArrayRef;
-    
+
 subtype AtLeastOneInt,
     ## Same problem as MyArrayRefInt02, see above.  Another way to solve it by
     ## forcing some sort of context.  Tried to fix this with method prototypes
     ## but just couldn't make it work.
     as (ArrayRef[Int]),
     where { @$_ > 0 };
+
 1;