X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FAttribute.pm;h=dfae8b27654126fe69db85f8e75d4890a7fbcf40;hb=a3f4f68e59a9f962a72410a3aa1ece6f1f3126b5;hp=851755db60d472c43b4d7789c07164abc7875f94;hpb=29607c0291634fac077d6e1c75e1491ba455c010;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 851755d..dfae8b2 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -209,8 +209,7 @@ sub validate_args { confess "You cannot auto-dereference anything other than a ArrayRef or HashRef on attribute ($name)" if $args->{auto_deref} - && $args->{isa} ne 'ArrayRef' - && $args->{isa} ne 'HashRef'; + && $args->{isa} !~ /^(?:ArrayRef|HashRef)(?:\[.*\])?$/; if ($args->{trigger}) { if (ref($args->{trigger}) eq 'HASH') { @@ -225,13 +224,14 @@ sub validate_args { } sub verify_against_type_constraint { - return 1 unless $_[0]->{type_constraint}; + my ($self, $value) = @_; + my $tc = $self->type_constraint; + return 1 unless $tc; - local $_ = $_[1]; - return 1 if $_[0]->{type_constraint}->check($_); + local $_ = $value; + return 1 if $tc->check($value); - my $self = shift; - $self->verify_type_constraint_error($self->name, $_, $self->{type_constraint}); + $self->verify_type_constraint_error($self->name, $value, $tc); } sub verify_type_constraint_error {