my $class = shift;
my $meta = shift;
bless {
- instance => bless {} => $meta->name
+ instance => (bless {} => $meta->name)
} => $class;
}
return $self->{instance}->{$slot_name} = $value;
}
+sub has_slot {
+ my ($self, $slot_name) = @_;
+ exists $self->{instance}->{$slot_name} ? 1 : 0;
+}
+
+sub get_slot_value {
+ my ($self, $instance, $slot_name) = @_;
+ return $instance->{$slot_name};
+}
+
+sub set_slot_value {
+ my ($self, $instance, $slot_name, $value) = @_;
+ $instance->{$slot_name} = $value;
+}
+
+sub has_slot_value {
+ my ($self, $instance, $slot_name) = @_;
+ defined $instance->{$slot_name} ? 1 : 0;
+}
+
sub get_instance { (shift)->{instance} }
1;
=item B<add_slot>
+=item B<has_slot>
+
+=item B<get_slot_value>
+
+=item B<set_slot_value>
+
+=item B<has_slot_value>
+
=item B<get_instance>
=back