X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FTypeConstraint.pm;h=41c850442d49ce76bd7821de9da16c0332af5467;hb=12f4a95a9552fd877d5efca81da5b60bc132d4c8;hp=2960e43b56b3e8a0340cee954d146e1a0a3692b0;hpb=1759509c4361c0a44d57bb501d464740247e2dc0;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/TypeConstraint.pm b/lib/Mouse/Meta/TypeConstraint.pm index 2960e43..41c8504 100644 --- a/lib/Mouse/Meta/TypeConstraint.pm +++ b/lib/Mouse/Meta/TypeConstraint.pm @@ -1,9 +1,11 @@ package Mouse::Meta::TypeConstraint; use Mouse::Util qw(:meta); # enables strict and warnings +use Scalar::Util (); use overload 'bool' => sub (){ 1 }, # always true '""' => sub { $_[0]->name }, # stringify to tc name + '0+' => sub { Scalar::Util::refaddr($_[0]) }, '|' => sub { # or-combination require Mouse::Util::TypeConstraints; return Mouse::Util::TypeConstraints::find_or_parse_type_constraint( @@ -14,7 +16,8 @@ use overload fallback => 1; sub new { - my($class, %args) = @_; + my $class = shift; + my %args = @_ == 1 ? %{$_[0]} : @_; $args{name} = '__ANON__' if !defined $args{name}; @@ -164,7 +167,7 @@ sub get_message { } else { $value = ( defined $value ? overload::StrVal($value) : 'undef' ); - return "Validation failed for '$self' failed with value $value"; + return "Validation failed for '$self' with value $value"; } } @@ -236,7 +239,7 @@ Mouse::Meta::TypeConstraint - The Mouse Type Constraint metaclass =head1 VERSION -This document describes Mouse version 0.54 +This document describes Mouse version 0.67 =head1 DESCRIPTION