From 19faa93b99c6132ae36dbb641730301df514a608 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 17 Oct 2013 14:27:10 -0400 Subject: [PATCH] cleanups --- lib/mop/attribute.pm | 91 +++++++++++++++++++----------------------- lib/mop/class.pm | 68 ++++++++++++-------------------- lib/mop/method.pm | 70 +++++++++++++++------------------ lib/mop/object.pm | 29 ++++++-------- lib/mop/role.pm | 94 +++++++++++++++----------------------------- 5 files changed, 140 insertions(+), 212 deletions(-) diff --git a/lib/mop/attribute.pm b/lib/mop/attribute.pm index 1c29375..9bc784e 100644 --- a/lib/mop/attribute.pm +++ b/lib/mop/attribute.pm @@ -4,6 +4,7 @@ use v5.16; use warnings; use Scalar::Util qw[ weaken isweak ]; +use mop::internals::util; our $VERSION = '0.02'; our $AUTHORITY = 'cpan:STEVAN'; @@ -11,10 +12,19 @@ our $AUTHORITY = 'cpan:STEVAN'; use parent 'mop::object', 'mop::internals::observable'; mop::internals::util::init_attribute_storage(my %name); -mop::internals::util::init_attribute_storage(my %original_id); mop::internals::util::init_attribute_storage(my %default); -mop::internals::util::init_attribute_storage(my %storage); mop::internals::util::init_attribute_storage(my %associated_meta); +mop::internals::util::init_attribute_storage(my %original_id); +mop::internals::util::init_attribute_storage(my %storage); + +sub name { ${ $name{ $_[0] } // \undef } } +sub associated_meta { ${ $associated_meta{ $_[0] } // \undef } } + +sub set_associated_meta { + my ($self, $meta) = @_; + $associated_meta{ $self } = \$meta; + weaken(${ $associated_meta{ $self } }); +} # temporary, for bootstrapping sub new { @@ -54,14 +64,13 @@ sub clone { ); } -sub name { ${ $name{ $_[0] } } } - sub key_name { my $self = shift; substr( $self->name, 2, length $self->name ) } sub has_default { defined( ${ $default{ $_[0] } } ) } + sub set_default { my $self = shift; my ($value) = @_; @@ -70,7 +79,9 @@ sub set_default { } $default{ $self } = \$value } + sub clear_default { ${ delete $default{ $_[0] } } } + sub get_default { my $self = shift; my $value = ${ $default{ $self } }; @@ -80,14 +91,8 @@ sub get_default { $value } -sub associated_meta { ${ $associated_meta{ $_[0] } // \undef } } -sub set_associated_meta { - my ($self, $meta) = @_; - $associated_meta{ $self } = \$meta; - weaken(${ $associated_meta{ $self } }); -} - sub conflicts_with { ${ $original_id{ $_[0] } } ne ${ $original_id{ $_[1] } } } + sub locally_defined { ${ $original_id{ $_[0] } } eq mop::id( $_[0] ) } sub has_data_in_slot_for { @@ -130,66 +135,59 @@ sub is_data_in_slot_weak_for { } sub __INIT_METACLASS__ { - state $METACLASS; - return $METACLASS if defined $METACLASS; - require mop::class; - $METACLASS = mop::class->new( + my $METACLASS = mop::class->new( name => 'mop::attribute', version => $VERSION, authority => $AUTHORITY, - superclass => 'mop::object' + superclass => 'mop::object', ); $METACLASS->add_attribute(mop::attribute->new( name => '$!name', - storage => \%name + storage => \%name, + )); + $METACLASS->add_attribute(mop::attribute->new( + name => '$!default', + storage => \%default, + )); + $METACLASS->add_attribute(mop::attribute->new( + name => '$!associated_meta', + storage => \%associated_meta, )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!original_id', storage => \%original_id, default => sub { mop::id($_) }, )); - - $METACLASS->add_attribute(mop::attribute->new( - name => '$!default', - storage => \%default - )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!storage', storage => \%storage, default => sub { mop::internals::util::init_attribute_storage(my %x) }, )); - $METACLASS->add_attribute(mop::attribute->new( - name => '$!associated_meta', - storage => \%associated_meta - )); - $METACLASS->add_method( mop::method->new( name => 'BUILD', body => \&BUILD ) ); - $METACLASS->add_method( mop::method->new( name => 'name', body => \&name ) ); - $METACLASS->add_method( mop::method->new( name => 'key_name', body => \&key_name ) ); - - $METACLASS->add_method( mop::method->new( name => 'has_default', body => \&has_default ) ); - $METACLASS->add_method( mop::method->new( name => 'get_default', body => \&get_default ) ); - $METACLASS->add_method( mop::method->new( name => 'set_default', body => \&set_default ) ); - $METACLASS->add_method( mop::method->new( name => 'clear_default', body => \&clear_default ) ); + $METACLASS->add_method( mop::method->new( name => 'name', body => \&name ) ); + $METACLASS->add_method( mop::method->new( name => 'key_name', body => \&key_name ) ); - $METACLASS->add_method( mop::method->new( name => 'storage', body => \&storage ) ); + $METACLASS->add_method( mop::method->new( name => 'has_default', body => \&has_default ) ); + $METACLASS->add_method( mop::method->new( name => 'get_default', body => \&get_default ) ); + $METACLASS->add_method( mop::method->new( name => 'set_default', body => \&set_default ) ); + $METACLASS->add_method( mop::method->new( name => 'clear_default', body => \&clear_default ) ); $METACLASS->add_method( mop::method->new( name => 'associated_meta', body => \&associated_meta ) ); $METACLASS->add_method( mop::method->new( name => 'set_associated_meta', body => \&set_associated_meta ) ); - $METACLASS->add_method( mop::method->new( name => 'conflicts_with', body => \&conflicts_with ) ); - $METACLASS->add_method( mop::method->new( name => 'locally_defined', body => \&locally_defined ) ); - $METACLASS->add_method( mop::method->new( name => 'has_data_in_slot_for', body => \&has_data_in_slot_for ) ); + $METACLASS->add_method( mop::method->new( name => 'conflicts_with', body => \&conflicts_with ) ); + $METACLASS->add_method( mop::method->new( name => 'locally_defined', body => \&locally_defined ) ); + + $METACLASS->add_method( mop::method->new( name => 'has_data_in_slot_for', body => \&has_data_in_slot_for ) ); $METACLASS->add_method( mop::method->new( name => 'fetch_data_in_slot_for', body => \&fetch_data_in_slot_for ) ); $METACLASS->add_method( mop::method->new( name => 'store_data_in_slot_for', body => \&store_data_in_slot_for ) ); $METACLASS->add_method( mop::method->new( name => 'store_default_in_slot_for', body => \&store_default_in_slot_for ) ); - $METACLASS->add_method( mop::method->new( name => 'weaken_data_in_slot_for', body => \&weaken_data_in_slot_for ) ); + $METACLASS->add_method( mop::method->new( name => 'weaken_data_in_slot_for', body => \&weaken_data_in_slot_for ) ); $METACLASS->add_method( mop::method->new( name => 'is_data_in_slot_weak_for', body => \&is_data_in_slot_weak_for ) ); + $METACLASS; } @@ -213,8 +211,6 @@ TODO =item C -=item C - =item C =item C @@ -227,8 +223,6 @@ TODO =item C -=item C - =item C =item C @@ -280,11 +274,6 @@ the same terms as the Perl 5 programming language system itself. =for Pod::Coverage new + clone =cut - - - - - - diff --git a/lib/mop/class.pm b/lib/mop/class.pm index baa54a2..20f73ae 100644 --- a/lib/mop/class.pm +++ b/lib/mop/class.pm @@ -10,10 +10,17 @@ our $AUTHORITY = 'cpan:STEVAN'; use parent 'mop::role'; -mop::internals::util::init_attribute_storage(my %is_abstract); mop::internals::util::init_attribute_storage(my %superclass); +mop::internals::util::init_attribute_storage(my %is_abstract); mop::internals::util::init_attribute_storage(my %instance_generator); +sub superclass { ${ $superclass{ $_[0] } // \undef } } +sub is_abstract { ${ $is_abstract{ $_[0] } // \undef } } +sub instance_generator { ${ $instance_generator{ $_[0] } // \undef } } + +sub make_class_abstract { $is_abstract{ $_[0] } = \1 } +sub set_instance_generator { $instance_generator{ $_[0] } = \$_[1] } + # temporary, for bootstrapping sub new { my $class = shift; @@ -52,15 +59,7 @@ sub BUILD { } } -# identity - -sub superclass { ${ $superclass{ $_[0] } // \undef } } - -sub is_abstract { ${ $is_abstract{ $_[0] } } } - -sub make_class_abstract { $is_abstract{ $_[0] } = \1 } - -# instance creation +sub create_fresh_instance_structure { (shift)->instance_generator->() } sub new_instance { my $self = shift; @@ -120,35 +119,23 @@ sub clone_instance { return $clone; } -sub instance_generator { ${ $instance_generator{ $_[0] } } } -sub set_instance_generator { $instance_generator{ $_[0] } = \$_[1] } - -sub create_fresh_instance_structure { (shift)->instance_generator->() } - -# events - sub __INIT_METACLASS__ { - state $METACLASS; - return $METACLASS if defined $METACLASS; - require mop::class; - $METACLASS = mop::class->new( + my $METACLASS = mop::class->new( name => 'mop::class', version => $VERSION, authority => $AUTHORITY, - superclass => 'mop::object' + superclass => 'mop::object', ); + $METACLASS->add_attribute(mop::attribute->new( + name => '$!superclass', + storage => \%superclass, + )); $METACLASS->add_attribute(mop::attribute->new( name => '$!is_abstract', storage => \%is_abstract, default => 0, )); - - $METACLASS->add_attribute(mop::attribute->new( - name => '$!superclass', - storage => \%superclass - )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!instance_generator', storage => \%instance_generator, @@ -157,18 +144,18 @@ sub __INIT_METACLASS__ { $METACLASS->add_method( mop::method->new( name => 'BUILD', body => \&BUILD ) ); - $METACLASS->add_method( mop::method->new( name => 'superclass', body => \&superclass ) ); - $METACLASS->add_method( mop::method->new( name => 'is_abstract', body => \&is_abstract ) ); + $METACLASS->add_method( mop::method->new( name => 'is_abstract', body => \&is_abstract ) ); $METACLASS->add_method( mop::method->new( name => 'make_class_abstract', body => \&make_class_abstract ) ); - $METACLASS->add_method( mop::method->new( name => 'new_instance', body => \&new_instance ) ); - $METACLASS->add_method( mop::method->new( name => 'clone_instance', body => \&clone_instance ) ); - $METACLASS->add_method( mop::method->new( name => 'instance_generator', body => \&instance_generator ) ); - $METACLASS->add_method( mop::method->new( name => 'set_instance_generator', body => \&set_instance_generator ) ); + $METACLASS->add_method( mop::method->new( name => 'instance_generator', body => \&instance_generator ) ); + $METACLASS->add_method( mop::method->new( name => 'set_instance_generator', body => \&set_instance_generator ) ); $METACLASS->add_method( mop::method->new( name => 'create_fresh_instance_structure', body => \&create_fresh_instance_structure ) ); + $METACLASS->add_method( mop::method->new( name => 'new_instance', body => \&new_instance ) ); + $METACLASS->add_method( mop::method->new( name => 'clone_instance', body => \&clone_instance ) ); + $METACLASS; } @@ -198,16 +185,16 @@ TODO =item C -=item C - -=item C - =item C =item C =item C +=item C + +=item C + =back =head1 SEE ALSO @@ -241,8 +228,3 @@ the same terms as the Perl 5 programming language system itself. new =cut - - - - - diff --git a/lib/mop/method.pm b/lib/mop/method.pm index de83458..8352d28 100644 --- a/lib/mop/method.pm +++ b/lib/mop/method.pm @@ -4,6 +4,7 @@ use v5.16; use warnings; use Scalar::Util qw[ weaken ]; +use mop::internals::util; our $VERSION = '0.02'; our $AUTHORITY = 'cpan:STEVAN'; @@ -12,8 +13,18 @@ use parent 'mop::object', 'mop::internals::observable'; mop::internals::util::init_attribute_storage(my %name); mop::internals::util::init_attribute_storage(my %body); -mop::internals::util::init_attribute_storage(my %original_id); mop::internals::util::init_attribute_storage(my %associated_meta); +mop::internals::util::init_attribute_storage(my %original_id); + +sub name { ${ $name{ $_[0] } // \undef } } +sub body { ${ $body{ $_[0] } // \undef } } +sub associated_meta { ${ $associated_meta{ $_[0] } // \undef } } + +sub set_associated_meta { + my ($self, $meta) = @_; + $associated_meta{ $self } = \$meta; + weaken(${ $associated_meta{ $self } }); +} # temporary, for bootstrapping sub new { @@ -39,19 +50,6 @@ sub clone { return ref($self)->new(name => $self->name, body => $self->body); } -sub name { ${ $name{ $_[0] } } } -sub body { ${ $body{ $_[0] } } } - -sub associated_meta { ${ $associated_meta{ $_[0] } // \undef } } -sub set_associated_meta { - my ($self, $meta) = @_; - $associated_meta{ $self } = \$meta; - weaken(${ $associated_meta{ $self } }); -} - -sub conflicts_with { ${ $original_id{ $_[0] } } ne ${ $original_id{ $_[1] } } } -sub locally_defined { ${ $original_id{ $_[0] } } eq mop::id( $_[0] ) } - sub execute { my ($self, $invocant, $args) = @_; @@ -72,46 +70,46 @@ sub execute { return $wantarray ? @result : $result[0]; } +sub conflicts_with { ${ $original_id{ $_[0] } } ne ${ $original_id{ $_[1] } } } + +sub locally_defined { ${ $original_id{ $_[0] } } eq mop::id( $_[0] ) } + sub __INIT_METACLASS__ { - state $METACLASS; - return $METACLASS if defined $METACLASS; - require mop::class; - $METACLASS = mop::class->new( + my $METACLASS = mop::class->new( name => 'mop::method', version => $VERSION, authority => $AUTHORITY, - superclass => 'mop::object' + superclass => 'mop::object', ); $METACLASS->add_attribute(mop::attribute->new( name => '$!name', - storage => \%name + storage => \%name, )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!body', - storage => \%body + storage => \%body, )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!associated_meta', - storage => \%associated_meta + storage => \%associated_meta, )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!original_id', storage => \%original_id, default => sub { mop::id($_) }, )); - $METACLASS->add_method( mop::method->new( name => 'name', body => \&name ) ); - $METACLASS->add_method( mop::method->new( name => 'body', body => \&body ) ); + $METACLASS->add_method( mop::method->new( name => 'name', body => \&name ) ); + + $METACLASS->add_method( mop::method->new( name => 'body', body => \&body ) ); + $METACLASS->add_method( mop::method->new( name => 'execute', body => \&execute ) ); + $METACLASS->add_method( mop::method->new( name => 'associated_meta', body => \&associated_meta ) ); $METACLASS->add_method( mop::method->new( name => 'set_associated_meta', body => \&set_associated_meta ) ); - $METACLASS->add_method( mop::method->new( name => 'conflicts_with', body => \&conflicts_with ) ); - $METACLASS->add_method( mop::method->new( name => 'locally_defined', body => \&locally_defined ) ); - $METACLASS->add_method( mop::method->new( name => 'execute', body => \&execute ) ); + $METACLASS->add_method( mop::method->new( name => 'conflicts_with', body => \&conflicts_with ) ); + $METACLASS->add_method( mop::method->new( name => 'locally_defined', body => \&locally_defined ) ); $METACLASS; } @@ -136,12 +134,12 @@ TODO =item C -=item C - =item C =item C +=item C + =item C =item C @@ -150,8 +148,6 @@ TODO =item C -=item C - =back =head1 SEE ALSO @@ -183,10 +179,6 @@ the same terms as the Perl 5 programming language system itself. =for Pod::Coverage new + clone =cut - - - - - diff --git a/lib/mop/object.pm b/lib/mop/object.pm index 0ab2e8a..46139df 100644 --- a/lib/mop/object.pm +++ b/lib/mop/object.pm @@ -3,7 +3,7 @@ package mop::object; use v5.16; use warnings; -use Scalar::Util qw[ blessed ]; +use mop::internals::util; our $VERSION = '0.02'; our $AUTHORITY = 'cpan:STEVAN'; @@ -13,7 +13,7 @@ sub new { # NOTE: # prior to the bootstrapping being - # finished, we need to not try and + # finished, we need to not try to # build classes, it will all be done # manually in the mop:: classes. # this method will be replaced once @@ -52,30 +52,30 @@ sub DESTROY { } sub __INIT_METACLASS__ { - state $METACLASS; - return $METACLASS if defined $METACLASS; - require mop::class; - $METACLASS = mop::class->new( + my $METACLASS = mop::class->new( name => 'mop::object', version => $VERSION, authority => $AUTHORITY, ); + $METACLASS->add_method( mop::method->new( name => 'new', body => sub { my $class = shift; - my %args = scalar(@_) == 1 && ref $_[0] eq 'HASH' - ? %{$_[0]} - : @_; + my (%args) = @_ == 1 && ref $_[0] eq 'HASH' ? %{$_[0]} : @_; mop::internals::util::find_or_inflate_meta($class)->new_instance(%args); } ) ); - $METACLASS->add_method( mop::method->new( name => 'clone', body => \&clone ) ); - $METACLASS->add_method( mop::method->new( name => 'does', body => \&does ) ); - $METACLASS->add_method( mop::method->new( name => 'DOES', body => \&DOES ) ); + + $METACLASS->add_method( mop::method->new( name => 'clone', body => \&clone ) ); + + $METACLASS->add_method( mop::method->new( name => 'does', body => \&does ) ); + $METACLASS->add_method( mop::method->new( name => 'DOES', body => \&DOES ) ); + $METACLASS->add_method( mop::method->new( name => 'DESTROY', body => \&DESTROY ) ); + $METACLASS; } @@ -133,8 +133,3 @@ This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut - - - - - diff --git a/lib/mop/role.pm b/lib/mop/role.pm index 9b02baa..b34044f 100644 --- a/lib/mop/role.pm +++ b/lib/mop/role.pm @@ -13,12 +13,19 @@ use parent 'mop::object', 'mop::internals::observable'; mop::internals::util::init_attribute_storage(my %name); mop::internals::util::init_attribute_storage(my %version); mop::internals::util::init_attribute_storage(my %authority); - mop::internals::util::init_attribute_storage(my %roles); mop::internals::util::init_attribute_storage(my %attributes); mop::internals::util::init_attribute_storage(my %methods); mop::internals::util::init_attribute_storage(my %required_methods); +sub name { ${ $name{ $_[0] } // \undef } } +sub version { ${ $version{ $_[0] } // \undef } } +sub authority { ${ $authority{ $_[0] } // \undef } } +sub roles { ${ $roles{ $_[0] } // \undef } } +sub attribute_map { ${ $attributes{ $_[0] } // \undef } } +sub method_map { ${ $methods{ $_[0] } // \undef } } +sub required_method_map { ${ $required_methods{ $_[0] } // \undef } } + # temporary, for bootstrapping sub new { my $class = shift; @@ -26,9 +33,9 @@ sub new { my $self = $class->SUPER::new( @_ ); - $name{ $self } = \($args{'name'}); - $version{ $self } = \($args{'version'}); - $authority{ $self } = \($args{'authority'}); + $name{ $self } = \($args{'name'}); + $version{ $self } = \($args{'version'}); + $authority{ $self } = \($args{'authority'}); $roles{ $self } = \($args{'roles'} || []); $attributes{ $self } = \({}); @@ -78,16 +85,6 @@ sub clone { return $clone; } -# identity - -sub name { ${ $name{ $_[0] } // \undef } } -sub version { ${ $version{ $_[0] } // \undef } } -sub authority { ${ $authority{ $_[0] } // \undef } } - -# roles - -sub roles { ${ $roles{ $_[0] } } } - sub add_role { my ($self, $role) = @_; push @{ $self->roles } => $role; @@ -102,12 +99,8 @@ sub does_role { return 0; } -# attributes - sub attribute_class { 'mop::attribute' } -sub attribute_map { ${ $attributes{ $_[0] } } } - sub attributes { values %{ $_[0]->attribute_map } } sub add_attribute { @@ -131,12 +124,8 @@ sub remove_attribute { delete $self->attribute_map->{ $name }; } -# methods - sub method_class { 'mop::method' } -sub method_map { ${ $methods{ $_[0] } } } - sub methods { values %{ $_[0]->method_map } } sub add_method { @@ -161,10 +150,6 @@ sub remove_method { delete $self->method_map->{ $name }; } -# required methods - -sub required_method_map { ${ $required_methods{ $_[0] } } } - sub required_methods { keys %{ $_[0]->required_method_map } } sub add_required_method { @@ -182,8 +167,6 @@ sub requires_method { defined $self->required_method_map->{ $name }; } -# events - sub FINALIZE { my $self = shift; @@ -236,14 +219,11 @@ sub FINALIZE { } sub __INIT_METACLASS__ { - state $METACLASS; - return $METACLASS if defined $METACLASS; - require mop::class; - $METACLASS = mop::class->new( + my $METACLASS = mop::class->new( name => 'mop::role', version => $VERSION, authority => $AUTHORITY, - superclass => 'mop::object' + superclass => 'mop::object', ); $METACLASS->add_attribute(mop::attribute->new( @@ -251,35 +231,29 @@ sub __INIT_METACLASS__ { storage => \%name, default => sub { die "name is required when creating a role or class" }, )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!version', - storage => \%version + storage => \%version, )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!authority', - storage => \%authority + storage => \%authority, )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!roles', storage => \%roles, default => sub { [] }, )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!attributes', storage => \%attributes, default => sub { {} }, )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!methods', storage => \%methods, default => sub { {} }, )); - $METACLASS->add_attribute(mop::attribute->new( name => '$!required_methods', storage => \%required_methods, @@ -287,23 +261,24 @@ sub __INIT_METACLASS__ { )); $METACLASS->add_method( mop::method->new( name => 'BUILD', body => \&BUILD ) ); - $METACLASS->add_method( mop::method->new( name => 'clone', body => \&clone ) ); - $METACLASS->add_method( mop::method->new( name => 'name', body => \&name ) ); - $METACLASS->add_method( mop::method->new( name => 'version', body => \&version ) ); - $METACLASS->add_method( mop::method->new( name => 'authority', body => \&authority ) ); + $METACLASS->add_method( mop::method->new( name => 'name', body => \&name ) ); + + $METACLASS->add_method( mop::method->new( name => 'version', body => \&version ) ); + + $METACLASS->add_method( mop::method->new( name => 'authority', body => \&authority ) ); $METACLASS->add_method( mop::method->new( name => 'roles', body => \&roles ) ); $METACLASS->add_method( mop::method->new( name => 'add_role', body => \&add_role ) ); $METACLASS->add_method( mop::method->new( name => 'does_role', body => \&does_role ) ); - $METACLASS->add_method( mop::method->new( name => 'attribute_class', body => \&attribute_class ) ); - $METACLASS->add_method( mop::method->new( name => 'attribute_map', body => \&attribute_map ) ); - $METACLASS->add_method( mop::method->new( name => 'attributes', body => \&attributes ) ); - $METACLASS->add_method( mop::method->new( name => 'get_attribute', body => \&get_attribute ) ); - $METACLASS->add_method( mop::method->new( name => 'add_attribute', body => \&add_attribute ) ); - $METACLASS->add_method( mop::method->new( name => 'has_attribute', body => \&has_attribute ) ); + $METACLASS->add_method( mop::method->new( name => 'attribute_class', body => \&attribute_class ) ); + $METACLASS->add_method( mop::method->new( name => 'attribute_map', body => \&attribute_map ) ); + $METACLASS->add_method( mop::method->new( name => 'attributes', body => \&attributes ) ); + $METACLASS->add_method( mop::method->new( name => 'get_attribute', body => \&get_attribute ) ); + $METACLASS->add_method( mop::method->new( name => 'add_attribute', body => \&add_attribute ) ); + $METACLASS->add_method( mop::method->new( name => 'has_attribute', body => \&has_attribute ) ); $METACLASS->add_method( mop::method->new( name => 'remove_attribute', body => \&remove_attribute ) ); $METACLASS->add_method( mop::method->new( name => 'method_class', body => \&method_class ) ); @@ -314,12 +289,11 @@ sub __INIT_METACLASS__ { $METACLASS->add_method( mop::method->new( name => 'has_method', body => \&has_method ) ); $METACLASS->add_method( mop::method->new( name => 'remove_method', body => \&remove_method ) ); - $METACLASS->add_method( mop::method->new( name => 'required_methods', body => \&required_methods ) ); - $METACLASS->add_method( mop::method->new( name => 'required_method_map', body => \&required_method_map ) ); - $METACLASS->add_method( mop::method->new( name => 'add_required_method', body => \&add_required_method ) ); + $METACLASS->add_method( mop::method->new( name => 'required_methods', body => \&required_methods ) ); + $METACLASS->add_method( mop::method->new( name => 'required_method_map', body => \&required_method_map ) ); + $METACLASS->add_method( mop::method->new( name => 'add_required_method', body => \&add_required_method ) ); + $METACLASS->add_method( mop::method->new( name => 'requires_method', body => \&requires_method ) ); $METACLASS->add_method( mop::method->new( name => 'remove_required_method', body => \&remove_required_method ) ); - $METACLASS->add_method( mop::method->new( name => 'requires_method', body => \&requires_method ) ); - $METACLASS->add_method( mop::method->new( name => 'FINALIZE', body => \&FINALIZE ) ); @@ -394,10 +368,10 @@ TODO =item C -=item C - =item C +=item C + =item C =back @@ -430,7 +404,3 @@ This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut - - - -