use Scalar::Util 'weaken', 'blessed';
-our $VERSION = '0.89';
+our $VERSION = '0.92';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
}
sub _new {
- my ( $class, %options ) = @_;
- bless {
+ my $class = shift;
+ return Class::MOP::Class->initialize($class)->new_object(@_)
+ if $class ne __PACKAGE__;
+
+ my $params = @_ == 1 ? $_[0] : {@_};
+ return bless {
# NOTE:
# I am not sure that it makes
# sense to pass in the meta
# which is *probably* a safe
# assumption,.. but you can
# never tell <:)
- 'associated_metaclass' => $options{associated_metaclass},
- 'attributes' => $options{attributes},
- 'slots' => $options{slots},
- 'slot_hash' => $options{slot_hash},
+ 'associated_metaclass' => $params->{associated_metaclass},
+ 'attributes' => $params->{attributes},
+ 'slots' => $params->{slots},
+ 'slot_hash' => $params->{slot_hash},
} => $class;
}
sub inline_slot_access {
my ($self, $instance, $slot_name) = @_;
- sprintf q[%s->{'%s'}], $instance, quotemeta($slot_name);
+ sprintf q[%s->{"%s"}], $instance, quotemeta($slot_name);
}
sub inline_get_slot_value {