use Carp 'confess';
use Scalar::Util 'blessed', 'weaken';
-our $VERSION = '0.83';
+our $VERSION = '0.92';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
my $name = $options{name};
- (defined $name && $name)
+ (defined $name)
|| confess "You must provide a name for the attribute";
$options{init_arg} = $name
sub _new {
my $class = shift;
+
+ return Class::MOP::Class->initialize($class)->new_object(@_)
+ if $class ne __PACKAGE__;
+
my $options = @_ == 1 ? $_[0] : {@_};
bless {
sub initializer { $_[0]->{'initializer'} }
sub definition_context { $_[0]->{'definition_context'} }
sub insertion_order { $_[0]->{'insertion_order'} }
-sub set_insertion_order { $_[0]->{'insertion_order'} = $_[1] }
+sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] }
# end bootstrapped away method section.
# (all methods below here are kept intact)
}
sub is_default_a_coderef {
- ('CODE' eq ref($_[0]->{'default'}))
+ my ($value) = $_[0]->{'default'};
+ return unless ref($value);
+ return ref($value) eq 'CODE' || (blessed($value) && $value->isa('Class::MOP::Method'));
}
sub default {