X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FObject.pm;h=e72542c5aed460adb60d9872462b86b8a5c0a7f2;hb=f3c1ccc818bb5c50c50e17b9141b91c09b077b04;hp=4af0f3957d5d6f1f5342c90a21e61e831bfdd909;hpb=f89acace2fa0fd5e6b8c4ac40ab1794f1ca62887;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Object.pm b/lib/Mouse/Object.pm index 4af0f39..e72542c 100644 --- a/lib/Mouse/Object.pm +++ b/lib/Mouse/Object.pm @@ -13,7 +13,7 @@ sub new { my $instance = bless {}, $class; for my $attribute (values %{ $class->meta->get_attribute_map }) { - my $key = $attribute->init_arg; + my $key = $attribute->name; my $default; if (!exists($args{$key})) { @@ -33,7 +33,7 @@ sub new { $instance->{$key} = $value; weaken($instance->{$key}) - if $attribute->weak_ref; + if ref($instance->{$key}) && $attribute->is_weak_ref; } } else { @@ -50,7 +50,7 @@ sub new { $instance->{$key} = $args{$key}; weaken($instance->{$key}) - if $attribute->weak_ref; + if ref($instance->{$key}) && $attribute->is_weak_ref; if ($attribute->has_trigger) { $attribute->trigger->($instance, $args{$key}, $attribute);