Make the meta-instance class take a bare attribute name when inlining
[gitmo/Class-MOP.git] / lib / Class / MOP / Instance.pm
index 75df7ea..6808c2c 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 
 use Scalar::Util 'weaken', 'blessed';
 
-our $VERSION   = '0.64_01';
+our $VERSION   = '0.77';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -91,6 +91,11 @@ sub get_all_slots {
     return @{$self->{'slots'}};
 }
 
+sub get_all_attributes {
+    my $self = shift;
+    return @{$self->{attributes}};
+}
+
 sub is_valid_slot {
     my ($self, $slot_name) = @_;
     exists $self->{'slot_hash'}->{$slot_name};
@@ -167,7 +172,7 @@ sub inline_create_instance {
 
 sub inline_slot_access {
     my ($self, $instance, $slot_name) = @_;
-    sprintf "%s->{%s}", $instance, $slot_name;
+    sprintf q[%s->{"%s"}], $instance, quotemeta($slot_name);
 }
 
 sub inline_get_slot_value {
@@ -300,6 +305,12 @@ superclass changes.
 
 Defaults to false.
 
+=item B<get_all_attributes>
+
+This will return the current list of attributes (as
+Class::MOP::Attribute objects) based on what was given to this object
+in C<new>.
+
 =back
 
 =head2 Operations on Instance Structures