X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FInstance.pm;h=8643e3ebce5bf095dca878cb74930615f7691c7e;hb=074ec38f9e2ed902a2e82a0fb80fd502f824b17d;hp=670f48d9edc4f4a13debebf1a33167dac784607f;hpb=95e647f01bdb9147b9d27cb9ac49d2adebff27b8;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Instance.pm b/lib/Class/MOP/Instance.pm index 670f48d..8643e3e 100644 --- a/lib/Class/MOP/Instance.pm +++ b/lib/Class/MOP/Instance.pm @@ -6,7 +6,7 @@ use warnings; use Scalar::Util 'weaken', 'blessed'; -our $VERSION = '0.82_01'; +our $VERSION = '0.89'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -177,7 +177,7 @@ sub inline_create_instance { 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 { @@ -214,6 +214,11 @@ sub inline_strengthen_slot_value { $self->inline_set_slot_value($instance, $slot_name, $self->inline_slot_access($instance, $slot_name)); } +sub inline_rebless_instance_structure { + my ($self, $instance, $class_variable) = @_; + "bless $instance => $class_variable"; +} + 1; __END__ @@ -385,6 +390,12 @@ The second argument is a slot name. The method returns a snippet of code that, when inlined, performs some operation on the instance. +=item B<< $metainstance->inline_rebless_instance_structure($instance_variable, $class_variable) >> + +This takes the name of a variable that will, when inlined, represent the object +instance, and the name of a variable that will represent the class to rebless +into, and returns code to rebless an instance into a class. + =back =head2 Introspection