X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDecoratorLibrary.pm;h=374f2b9f32fcd31801c6cbde48ef8af7b19be247;hb=bb9f33718fd113a1802b2e64570bb4b6d258295f;hp=07304aae14e48c597f555a98f957a7a48741ec98;hpb=f235df49d0d645313d5afeecf7ace023bb6f78ad;p=gitmo%2FMooseX-Types.git diff --git a/t/lib/DecoratorLibrary.pm b/t/lib/DecoratorLibrary.pm index 07304aa..374f2b9 100644 --- a/t/lib/DecoratorLibrary.pm +++ b/t/lib/DecoratorLibrary.pm @@ -1,89 +1,3 @@ -<<<<<<< .working -package DecoratorLibrary; - -use MooseX::Types::Moose qw( Str ArrayRef HashRef Int ); -use MooseX::Types - -declare => [qw( - MyArrayRefBase - MyArrayRefInt01 - MyArrayRefInt02 - MyHashRefOfInts - MyHashRefOfStr - StrOrArrayRef - AtLeastOneInt - Jobs - SubOfMyArrayRefInt01 - BiggerInt - )]; - -subtype MyArrayRefBase, - as ArrayRef; - -coerce MyArrayRefBase, - from Str, - via {[split(',', $_)]}; - -subtype MyArrayRefInt01, - as ArrayRef[Int]; - -subtype BiggerInt, - as Int, - where {$_>10}; - -## We can change this when the .61 Moose comes out. When that happens we will -## have the correct patch to Moose::Meta::TypeConstraint::Parameterized to let -## us support parameterizing parameterized subtypes. When we get this we can -## then replace the where clause with: - - ##as MyArrayRefInt01[BiggerInt]; - -subtype SubOfMyArrayRefInt01, - as MyArrayRefInt01, - where { - my $ok_or_not = 1; - foreach my $int (@$_) { - $ok_or_not = $int>10 ? 1:0 - if $ok_or_not; - } $ok_or_not; - }; - -coerce MyArrayRefInt01, - from Str, - via {[split('\.',$_)]}, - from HashRef, - via {[sort values(%$_)]}; - -subtype MyArrayRefInt02, - as MyArrayRefBase[Int]; - -subtype MyHashRefOfInts, - as HashRef[Int]; - -subtype MyHashRefOfStr, - as HashRef[Str]; - -coerce MyArrayRefInt02, - from Str, - via {[split(':',$_)]}, - from MyHashRefOfInts, - via {[sort values(%$_)]}, - from MyHashRefOfStr, - via {[ sort map { length $_ } values(%$_) ]}, - from HashRef[ArrayRef], - via {[ sort map { @$_ } values(%$_) ]}; - -subtype StrOrArrayRef, - as Str|ArrayRef; - -subtype AtLeastOneInt, - as ArrayRef[Int], - where { @$_ > 0 }; - -enum Jobs, - (qw/Programming Teaching Banking/); - -1; -======= package DecoratorLibrary; use MooseX::Types::Moose qw( Str ArrayRef HashRef Int ); @@ -154,4 +68,3 @@ enum Jobs, (qw/Programming Teaching Banking/); 1; ->>>>>>> .merge-right.r6407