From: Dave Rolsky Date: Sun, 5 Jun 2011 15:54:43 +0000 (-0500) Subject: Cleanup some code in the docs X-Git-Tag: 0.26~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7b880bf1299a85294d3f0f104d81ceb62fad38fa;p=gitmo%2FMooseX-Types.git Cleanup some code in the docs --- diff --git a/lib/MooseX/Types.pm b/lib/MooseX/Types.pm index 4f16f9a..c011815 100644 --- a/lib/MooseX/Types.pm +++ b/lib/MooseX/Types.pm @@ -25,23 +25,27 @@ my $UndefMsg = q{Action for type '%s' not yet defined in library '%s'}; package MyLibrary; # predeclare our own types - use MooseX::Types - -declare => [qw( - PositiveInt NegativeInt - ArrayRefOfPositiveInt ArrayRefOfAtLeastThreeNegativeInts - LotsOfInnerConstraints StrOrArrayRef - MyDateTime - )]; + use MooseX::Types -declare => [ + qw( + PositiveInt + NegativeInt + ArrayRefOfPositiveInt + ArrayRefOfAtLeastThreeNegativeInts + LotsOfInnerConstraints + StrOrArrayRef + MyDateTime + ) + ]; # import builtin types use MooseX::Types::Moose qw/Int HashRef/; # type definition. - subtype PositiveInt, - as Int, + subtype PositiveInt, + as Int, where { $_ > 0 }, message { "Int is not larger than 0" }; - + subtype NegativeInt, as Int, where { $_ < 0 }, @@ -53,19 +57,19 @@ my $UndefMsg = q{Action for type '%s' not yet defined in library '%s'}; via { 1 }; # with parameterized constraints. - + subtype ArrayRefOfPositiveInt, as ArrayRef[PositiveInt]; - + subtype ArrayRefOfAtLeastThreeNegativeInts, as ArrayRef[NegativeInt], where { scalar(@$_) > 2 }; subtype LotsOfInnerConstraints, as ArrayRef[ArrayRef[HashRef[Int]]]; - + # with TypeConstraint Unions - + subtype StrOrArrayRef, as Str|ArrayRef;