From: Oliver Charles Date: Sat, 20 Nov 2010 19:59:49 +0000 (+0000) Subject: Add a BUILDARGS method to Moose::Meta::Attribute X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fabandoned%2Fis-traits;p=gitmo%2FMoose.git Add a BUILDARGS method to Moose::Meta::Attribute --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 248a1b7..98a6d52 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -59,7 +59,14 @@ sub _inline_throw_error { sub new { my ($class, $name, %options) = @_; - $class->_process_options($name, \%options) unless $options{__hack_no_process_options}; # used from clone()... YECHKKK FIXME ICKY YUCK GROSS + return $class->SUPER::new($name, $class->BUILDARGS($name, %options)); +} + +sub BUILDARGS { + my ( $class, $name, %options ) = @_; + + $class->_process_options($name, \%options) + unless $options{__hack_no_process_options}; # used from clone()... YECHKKK FIXME ICKY YUCK GROSS delete $options{__hack_no_process_options}; @@ -77,7 +84,7 @@ sub new { Carp::cluck "Found unknown argument(s) passed to '$name' attribute constructor in '$class': @bad"; } - return $class->SUPER::new($name, %options); + return %options; } sub interpolate_class_and_new {