X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FAttribute.pm;h=5bb0da11b9bb4ccb3a22af19bb20b073ac696900;hp=1b2fb034bc6332a8ea2773b6ae9bc1b0c9482632;hb=a25ca8d637c040b2f929b1a23dd62ff63d85f5d1;hpb=9ae9702effbac814bdd5304e2ff7d4157de754ff diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 1b2fb03..5bb0da1 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -248,7 +248,7 @@ sub canonicalize_args{ # DEPRECATED return %args; } -sub create { +sub create { # DEPRECATED my ($self, $class, $name, %args) = @_; Carp::cluck("$self->create has been deprecated." @@ -263,15 +263,12 @@ sub _coerce_and_verify { my($self, $value, $instance) = @_; my $type_constraint = $self->{type_constraint}; - - return $value if !$type_constraint; + return $value if !defined $type_constraint; if ($self->should_coerce && $type_constraint->has_coercion) { $value = $type_constraint->coerce($value); } - return $value if $type_constraint->check($value); - $self->verify_against_type_constraint($value); return $value; @@ -281,7 +278,7 @@ sub verify_against_type_constraint { my ($self, $value) = @_; my $type_constraint = $self->{type_constraint}; - return 1 if !$type_constraint;; + return 1 if !$type_constraint; return 1 if $type_constraint->check($value); $self->verify_type_constraint_error($self->name, $value, $type_constraint); @@ -289,7 +286,8 @@ sub verify_against_type_constraint { sub verify_type_constraint_error { my($self, $name, $value, $type) = @_; - $self->throw_error("Attribute ($name) does not pass the type constraint because: " . $type->get_message($value)); + $self->throw_error("Attribute ($name) does not pass the type constraint because: " + . $type->get_message($value)); } sub coerce_constraint { # DEPRECATED @@ -464,6 +462,10 @@ __END__ Mouse::Meta::Attribute - The Mouse attribute metaclass +=head1 VERSION + +This document describes Mouse version 0.37_06 + =head1 METHODS =head2 C<< new(%options) -> Mouse::Meta::Attribute >>