bump _all_ the versions to 0.71
[gitmo/Class-MOP.git] / lib / Class / MOP / Attribute.pm
index 496050d..fbdd09c 100644 (file)
@@ -9,7 +9,8 @@ use Class::MOP::Method::Accessor;
 use Carp         'confess';
 use Scalar::Util 'blessed', 'weaken';
 
-our $VERSION   = '0.65';
+our $VERSION   = '0.71';
+$VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
 use base 'Class::MOP::Object';
@@ -51,24 +52,31 @@ sub new {
         confess("A required attribute must have either 'init_arg', 'builder', or 'default'");
     }
 
+    $class->_new(\%options);
+}
+
+sub _new {
+    my $class = shift;
+    my $options = @_ == 1 ? $_[0] : {@_};
+
     bless {
-        'name'      => $name,
-        'accessor'  => $options{accessor},
-        'reader'    => $options{reader},
-        'writer'      => $options{writer},
-        'predicate'   => $options{predicate},
-        'clearer'     => $options{clearer},
-        'builder'     => $options{builder},
-        'init_arg'    => $options{init_arg},
-        'default'     => $options{default},
-        'initializer' => $options{initializer},        
+        'name'        => $options->{name},
+        'accessor'    => $options->{accessor},
+        'reader'      => $options->{reader},
+        'writer'      => $options->{writer},
+        'predicate'   => $options->{predicate},
+        'clearer'     => $options->{clearer},
+        'builder'     => $options->{builder},
+        'init_arg'    => $options->{init_arg},
+        'default'     => $options->{default},
+        'initializer' => $options->{initializer},        
         # keep a weakened link to the
         # class we are associated with
         'associated_class' => undef,
         # and a list of the methods
         # associated with this attr
         'associated_methods' => [],
-    } => $class;
+    }, $class;
 }
 
 # NOTE:
@@ -233,7 +241,7 @@ sub get_write_method_ref {
 }
 
 sub is_default_a_coderef {
-    ('CODE' eq ref($_[0]->{'default'} || $_[0]->{default}))
+    ('CODE' eq ref($_[0]->{'default'}))
 }
 
 sub default {