Fix the delegation rule
[gitmo/Mouse.git] / lib / Mouse / Meta / Class.pm
index 622f142..bbb52b0 100644 (file)
@@ -1,7 +1,7 @@
 package Mouse::Meta::Class;
 use Mouse::Util qw/:meta/; # enables strict and warnings
 
-use Scalar::Util qw/blessed weaken/;
+use Scalar::Util ();
 
 use Mouse::Meta::Module;
 our @ISA = qw(Mouse::Meta::Module);
@@ -87,7 +87,7 @@ sub inherit_from_foreign_class {
     my($class, $super) = @_;
     Carp::carp("You inherit from non-Mouse class ($super),"
         . " but it is unlikely to work correctly."
-        . " Please concider to use MouseX::Foreign");
+        . " Please consider using MouseX::Foreign");
     return;
 }
 
@@ -154,7 +154,7 @@ sub _collect_roles {
 }
 
 
-sub find_method_by_name{
+sub find_method_by_name {
     my($self, $method_name) = @_;
     defined($method_name)
         or $self->throw_error('You must define a method name to find');
@@ -181,6 +181,8 @@ sub get_all_method_names {
 
 sub find_attribute_by_name {
     my($self, $name) = @_;
+    defined($name)
+        or $self->throw_error('You must define an attribute name to find');
     foreach my $attr($self->get_all_attributes) {
         return $attr if $attr->name eq $name;
     }
@@ -192,7 +194,7 @@ sub add_attribute {
 
     my($attr, $name);
 
-    if(blessed $_[0]){
+    if(Scalar::Util::blessed($_[0])){
         $attr = $_[0];
 
         $attr->isa('Mouse::Meta::Attribute')
@@ -223,7 +225,7 @@ sub add_attribute {
         }
     }
 
-    weaken( $attr->{associated_class} = $self );
+    Scalar::Util::weaken( $attr->{associated_class} = $self );
 
     # install accessors first
     $attr->install_accessors();
@@ -459,7 +461,7 @@ Mouse::Meta::Class - The Mouse class metaclass
 
 =head1 VERSION
 
-This document describes Mouse version 0.73
+This document describes Mouse version 0.75
 
 =head1 DESCRIPTION