Revision history for Perl extension Moose
+0.06
+ * Moose
+ - refactored the keyword exports
+ - 'with' now checks Role validaity
+ - 'extends' makes metaclass adjustments as
+ needed to ensure metaclass compatability
+
+ * Moose::Util::TypeConstraints
+ - added the 'enum' keyword for simple
+ string enumerations which can be used as
+ type constraints
+ - see example of usage in t/008_basic.t
+
+ * Moose::Object
+ - more careful checking of params to new()
+
+ * Moose::Meta::Instance
+ - added new Instance metaclass to support
+ the new Class::MOP instance protocol
+
+ * Moose::Meta::Class
+ - some small changes to support the new
+ instance protocol
+
+ * Moose::Meta::Attribute
+ - some improvements to the accessor generation code
+ by nothingmuch
+ - some small changes to support the new
+ instance protocol
+ - (still somewhat) experimental delegation support
+ with the 'handles' option
+ - added several tests for this
+
0.05 Thurs. April 27, 2006
* Moose
- keywords are now exported with Sub::Exporter
# options which are not directly used
# but we store them for metadata purposes
-__PACKAGE__->meta->add_attribute('isa' => (
- reader => 'isa_metadata',
- predicate => 'has_isa_metadata',
-));
-__PACKAGE__->meta->add_attribute('does' => (
- reader => 'does_metadata',
- predicate => 'has_does_metadata',
-));
-__PACKAGE__->meta->add_attribute('is' => (
- reader => 'is_metadata',
- predicate => 'has_is_metadata',
-));
+__PACKAGE__->meta->add_attribute('isa' => (reader => '_isa_metadata'));
+__PACKAGE__->meta->add_attribute('does' => (reader => '_does_metadata'));
+__PACKAGE__->meta->add_attribute('is' => (reader => '_is_metadata'));
# these are actual options for the attrs
__PACKAGE__->meta->add_attribute('required' => (reader => 'is_required' ));
sub new {
my ($class, $name, %options) = @_;
$class->_process_options($name, \%options);
- my $self = $class->SUPER::new($name, %options);
- return $self;
+ return $class->SUPER::new($name, %options);
}
sub clone_and_inherit_options {
}
elsif ($options->{is} eq 'rw') {
$options->{accessor} = $name;
+ ((reftype($options->{trigger}) || '') eq 'CODE')
+ || confess "Trigger must be a CODE ref"
+ if exists $options->{trigger};
}
else {
confess "I do not understand this option (is => " . $options->{is} . ")"
}
}
- # process and check trigger here ...
-
-
if (exists $options->{isa}) {
if (exists $options->{does}) {
return;
}
+# private methods to help delegation ...
+
sub _canonicalize_handles {
my $self = shift;
my $handles = $self->handles;
sub _find_delegate_metaclass {
my $self = shift;
- if ($self->has_isa_metadata) {
- my $class = $self->isa_metadata;
+ if (my $class = $self->_isa_metadata) {
# if the class does have
# a meta method, use it
return $class->meta if $class->can('meta');
# our own metaclass
return Moose::Meta::Class->initialize($class);
}
- elsif ($self->has_does_metadata) {
+ elsif (my $role = $self->_does_metadata) {
# our role will always have
# a meta method
- return $self->does_metadata->meta;
+ return $role->meta;
}
else {
confess "Cannot find delegate metaclass for attribute " . $self->name;
Stevan Little E<lt>stevan@iinteractive.comE<gt>
+Yuval Kogman E<lt>nothingmuch@woobling.comE<gt>
+
=head1 COPYRIGHT AND LICENSE
Copyright 2006 by Infinity Interactive, Inc.