X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDecoratorLibrary.pm;h=6ded368f7cb2fc776ba00972754b9d1eebcbed3a;hb=e088dd0352e963c94da8202d73abd3a68b6f2486;hp=c99c18983d5d2f0c8f408e96c6f012d1e941aa93;hpb=cf1a8bfa50cb6cab796582ddae0a5b05dfcd8759;p=gitmo%2FMooseX-Types.git diff --git a/t/lib/DecoratorLibrary.pm b/t/lib/DecoratorLibrary.pm index c99c189..6ded368 100644 --- a/t/lib/DecoratorLibrary.pm +++ b/t/lib/DecoratorLibrary.pm @@ -12,6 +12,7 @@ use MooseX::Types MyHashRefOfInts MyHashRefOfStr StrOrArrayRef + AtLeastOneInt )]; subtype MyArrayRefBase, @@ -46,10 +47,18 @@ coerce MyArrayRefInt02, via {[sort values(%$_)]}, from MyHashRefOfStr, via {[ sort map { length $_ } values(%$_) ]}, - ### Can't do HashRef[ArrayRef] here, need to force precidence I guess??? + ## Can't do HashRef[ArrayRef] here since if I do HashRef get the via {} + ## Stuff passed as args. from HashRef([ArrayRef]), - via {[ sort map { @$_ } values(%$_)] }; + via {[ sort map { @$_ } values(%$_) ]}; subtype StrOrArrayRef, - from Str|ArrayRef; + 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;