use Carp 'confess';
use Scalar::Util 'blessed', 'weaken';
-our $VERSION = '0.65';
+our $VERSION = '0.64_07';
+$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
use base 'Class::MOP::Object';
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: