X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP.pm;h=474ae184a857d9383851f80a277792047daa1cb5;hb=742fb371653d58d3aca4dccadcb7dd4e7c736354;hp=14afdefe8a38abded2c81c25e23498fb85ceac17;hpb=1d68af0454f55a8b088f8bc1887a0a5ce54d2a22;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index 14afdef..474ae18 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -13,7 +13,7 @@ use Class::MOP::Method; use Class::MOP::Immutable; -our $VERSION = '0.43'; +our $VERSION = '0.47'; our $AUTHORITY = 'cpan:STEVAN'; { @@ -405,12 +405,12 @@ Class::MOP::Attribute->meta->add_method('new' => sub { if ref $options{builder} || !(defined $options{builder}); confess("Setting both default and builder is not allowed.") if exists $options{default}; + } else { + (Class::MOP::Attribute::is_default_a_coderef(\%options)) + || confess("References are not allowed as default values, you must ". + "wrap then in a CODE reference (ex: sub { [] } and not [])") + if exists $options{default} && ref $options{default}; } - (Class::MOP::Attribute::is_default_a_coderef(\%options)) - || confess("References are not allowed as default values, you must ". - "wrap then in a CODE reference (ex: sub { [] } and not [])") - if exists $options{default} && ref $options{default}; - # return the new object $class->meta->new_object(name => $name, %options); });