use Sub::Name 'subname';
use B 'svref_2object';
-our $VERSION = '0.18';
+our $VERSION = '0.19';
our $AUTHORITY = 'cpan:STEVAN';
use base 'Class::MOP::Module';
$meta = bless {
# inherited from Class::MOP::Package
'$:package' => $package_name,
- '%:namespace' => \%{$package_name . '::'},
+
+ # NOTE:
+ # since the following attributes will
+ # actually be loaded from the symbol
+ # table, and actually bypass the instance
+ # entirely, we can just leave these things
+ # listed here for reference, because they
+ # should not actually have a value associated
+ # with the slot.
+ '%:namespace' => \undef,
# inherited from Class::MOP::Module
- '$:version' => (exists ${$package_name . '::'}{'VERSION'} ? ${$package_name . '::VERSION'} : undef),
- '$:authority' => (exists ${$package_name . '::'}{'AUTHORITY'} ? ${$package_name . '::AUTHORITY'} : undef),
- # defined here ...
- '%:attributes' => {},
+ '$:version' => \undef,
+ '$:authority' => \undef,
+ # defined in Class::MOP::Class
+ '%:methods' => \undef,
+
+ '%:attributes' => {},
'$:attribute_metaclass' => $options{':attribute_metaclass'} || 'Class::MOP::Attribute',
'$:method_metaclass' => $options{':method_metaclass'} || 'Class::MOP::Method',
'$:instance_metaclass' => $options{':instance_metaclass'} || 'Class::MOP::Instance',
sub method_metaclass { $_[0]->{'$:method_metaclass'} }
sub instance_metaclass { $_[0]->{'$:instance_metaclass'} }
+sub get_method_map {
+ my $self = shift;
+ # FIXME:
+ # there is a faster/better way
+ # to do this, I am sure :)
+ return +{
+ map {
+ $_ => $self->get_method($_)
+ } grep {
+ $self->has_method($_)
+ } $self->list_all_package_symbols
+ };
+}
+
# Instance Construction & Cloning
sub new_object {
=over 4
+=item B<get_method_map>
+
=item B<method_metaclass>
=item B<add_method ($method_name, $method)>