From: Stevan Little Date: Mon, 20 Nov 2006 17:30:42 +0000 (+0000) Subject: foo X-Git-Tag: 0_18~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d49677609249e8366760986d199fc95897a64861;p=gitmo%2FMoose.git foo --- diff --git a/TODO b/TODO index 4d90ee8..38386c1 100644 --- a/TODO +++ b/TODO @@ -8,6 +8,19 @@ mst: if I do "subtype 'Foo' => as 'Bar';" I get an empty condition and it dies TODO ------------------------------------------------------------------------------- +- DDuncan's Str types + +subtype 'Str' + => as 'Value' + => where { Encode::is_utf8( $_[0] ) or $_[0] !~ m/[^0x00-0x7F]/x } + => optimize_as { defined($_[0]) && !ref($_[0]) }; + +subtype 'Blob' + => as 'Value' + => where { !Encode::is_utf8( $_[0] ) } + => optimize_as { defined($_[0]) && !ref($_[0]) }; + + - should handle some moose-specific options in &Moose::Meta::Class::create things like roles, and method modifiers (although those can probably be ignored if i want to) diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index b67c426..28fdca4 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -393,11 +393,11 @@ This is just sugar for the type constraint construction syntax. =head2 Type Coercion Constructors -Type constraints can also contain type coercions as well. In most -cases Moose will run the type-coercion code first, followed by the -type constraint check. This feature should be used carefully as it -is very powerful and could easily take off a limb if you are not -careful. +Type constraints can also contain type coercions as well. If you +ask your accessor too coerce, the Moose will run the type-coercion +code first, followed by the type constraint check. This feature +should be used carefully as it is very powerful and could easily +take off a limb if you are not careful. See the L for an example of how to use these.