Make the meta-instance class take a bare attribute name when inlining
[gitmo/Class-MOP.git] / lib / Class / MOP / Instance.pm
index c5aea5e..6808c2c 100644 (file)
@@ -6,7 +6,8 @@ use warnings;
 
 use Scalar::Util 'weaken', 'blessed';
 
-our $VERSION   = '0.65';
+our $VERSION   = '0.77';
+$VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
 use base 'Class::MOP::Object';
@@ -90,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};
@@ -166,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 {
@@ -299,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