From: gfx Date: Tue, 23 Feb 2010 02:57:09 +0000 (+0900) Subject: Clean up warnings X-Git-Tag: 0.50_04~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3b48bcc824fb6cfa90f907cf4d83e01c224a72dd;p=gitmo%2FMouse.git Clean up warnings --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 315eaa4..a66fb32 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -77,7 +77,9 @@ sub new { # (3) bad options found if(@bad){ @bad = sort @bad; - Carp::cluck("Found unknown argument(s) passed to '$name' attribute constructor in '$class': @bad"); + local $Carp::Internal{'Mouse'} = 1; + local $Carp::Internal{'Mouse::Meta::Class'} = 1; + Carp::carp("Found unknown argument(s) passed to '$name' attribute constructor in '$class': @bad"); } my $self = bless $args, $class; @@ -335,12 +337,6 @@ sub install_accessors{ $attribute->create($metaclass, $attribute->name, %{$attribute}); } - if(!$attribute->{associated_methods} && ($attribute->{is} || '') ne 'bare'){ - Carp::cluck( - 'Attribute (' . $attribute->name . ') of class ' . $metaclass->name - . ' has no associated methods (did you mean to provide an "is" argument?)'); - } - return; } diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index 84c36d5..607de86 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -6,6 +6,8 @@ use Scalar::Util qw/blessed weaken/; use Mouse::Meta::Module; our @ISA = qw(Mouse::Meta::Module); +our @CARP_NOT = qw(Mouse); # trust Mouse + sub attribute_metaclass; sub method_metaclass; @@ -187,8 +189,9 @@ sub add_attribute { $self->{attributes}{$attr->name} = $attr; $attr->install_accessors(); - if(Mouse::Util::_MOUSE_VERBOSE && !$attr->{associated_methods} && ($attr->{is} || '') ne 'bare'){ - Carp::cluck(qq{Attribute (}.$attr->name.qq{) of class }.$self->name.qq{ has no associated methods (did you mean to provide an "is" argument?)}); + if(!$attr->{associated_methods} && ($attr->{is} || '') ne 'bare'){ + Carp::carp(qq{Attribute ($name) of class }.$self->name + .qq{ has no associated methods (did you mean to provide an "is" argument?)}); } return $attr; }