X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FAttribute.pm;fp=lib%2FMoose%2FMeta%2FAttribute.pm;h=46a8412f0ecd474a7641091acfeb3475864c798c;hb=a917d5ae83dc260c6a84fed0ffdc0d1b70c50266;hp=56f3bc90b43ffd0ce47748d09ff9caa9079c6d03;hpb=e47c8833c3dca36ed98a0f70be769c9dd6ce759a;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 56f3bc9..46a8412 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -94,7 +94,22 @@ sub new { if (@bad) { - Carp::cluck "Found unknown argument(s) passed to '$name' attribute constructor in '$class': @bad"; + my $s = @bad > 1 ? 's' : ''; + my $list = join "', '", @bad; + + my $package = $options{definition_context}{package}; + my $context = $options{definition_context}{context} + || 'attribute constructor'; + my $type = $options{definition_context}{type} || 'class'; + + my $location = ''; + if (defined($package)) { + $location = " in "; + $location .= "$type " if $type; + $location .= $package; + } + + Carp::cluck "Found unknown argument$s '$list' in the $context for '$name'$location"; } return $class->SUPER::new($name, %options);