X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDecoratorLibrary.pm;h=9eee6ff25e7421aa53112dcdcbc1b2e291f405ee;hb=475bbd1d2a14bfa42b312ab45f32d9251ccde8cd;hp=6ded368f7cb2fc776ba00972754b9d1eebcbed3a;hpb=bb5b7b28b3e2fa8a6120e445ff58a0e377cf0806;p=gitmo%2FMooseX-Types.git diff --git a/t/lib/DecoratorLibrary.pm b/t/lib/DecoratorLibrary.pm index 6ded368..9eee6ff 100644 --- a/t/lib/DecoratorLibrary.pm +++ b/t/lib/DecoratorLibrary.pm @@ -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;