use Scalar::Util 'weaken', 'blessed';
-our $VERSION = '0.65';
+our $VERSION = '0.64_04';
+$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
use base 'Class::MOP::Object';
my $options = $class->BUILDARGS(@_);
# FIXME replace with a proper constructor
- my $instance = bless {
+ my $instance = $class->_new(%$options);
+
+ # FIXME weak_ref => 1,
+ weaken($instance->{'associated_metaclass'});
+
+ return $instance;
+}
+
+sub _new {
+ my ( $class, %options ) = @_;
+ 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' => $options{associated_metaclass},
+ 'attributes' => $options{attributes},
+ 'slots' => $options{slots},
+ 'slot_hash' => $options{slot_hash},
} => $class;
-
- # FIXME weak_ref => 1,
- weaken($instance->{'associated_metaclass'});
-
- return $instance;
}
sub _class_name { $_[0]->{_class_name} ||= $_[0]->associated_metaclass->name }
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};
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