From: Jesse Luehrs Date: Sat, 13 Nov 2010 21:49:05 +0000 (-0600) Subject: stop using the old-style api here, it's slower X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=74fce89954832b1359ca1d55f21c7a8110e089a9;p=gitmo%2FClass-MOP.git stop using the old-style api here, it's slower --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index d2f0b0a..b53ecb0 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -821,8 +821,7 @@ sub get_all_attributes { sub superclasses { my $self = shift; - my $isa = $self->get_or_add_package_symbol( - { sigil => '@', type => 'ARRAY', name => 'ISA' } ); + my $isa = $self->get_or_add_package_symbol('@ISA'); if (@_) { my @supers = @_; diff --git a/lib/Class/MOP/Mixin/HasMethods.pm b/lib/Class/MOP/Mixin/HasMethods.pm index e343d20..2fe0135 100644 --- a/lib/Class/MOP/Mixin/HasMethods.pm +++ b/lib/Class/MOP/Mixin/HasMethods.pm @@ -82,10 +82,7 @@ sub add_method { subname( $full_method_name => $body ); } - $self->add_package_symbol( - { sigil => '&', type => 'CODE', name => $method_name }, - $body, - ); + $self->add_package_symbol("&$method_name", $body); } sub _code_is_mine { @@ -133,13 +130,7 @@ sub _get_maybe_raw_method { my $map_entry = $self->_method_map->{$method_name}; return $map_entry if defined $map_entry; - my $code = $self->get_package_symbol( - { - name => $method_name, - sigil => '&', - type => 'CODE', - } - ); + my $code = $self->get_package_symbol("&$method_name"); unless ($map_entry) { return unless $code && $self->_code_is_mine($code); @@ -155,8 +146,7 @@ sub remove_method { my $removed_method = delete $self->_method_map->{$method_name}; - $self->remove_package_symbol( - { sigil => '&', type => 'CODE', name => $method_name } ); + $self->remove_package_symbol("&$method_name"); $removed_method->detach_from_class if $removed_method && blessed $removed_method; diff --git a/lib/Class/MOP/Module.pm b/lib/Class/MOP/Module.pm index 77ce02a..2aac74a 100644 --- a/lib/Class/MOP/Module.pm +++ b/lib/Class/MOP/Module.pm @@ -33,12 +33,12 @@ sub _new { sub version { my $self = shift; - ${$self->get_or_add_package_symbol({ sigil => '$', type => 'SCALAR', name => 'VERSION' })}; + ${$self->get_or_add_package_symbol('$VERSION')}; } sub authority { my $self = shift; - ${$self->get_or_add_package_symbol({ sigil => '$', type => 'SCALAR', name => 'AUTHORITY' })}; + ${$self->get_or_add_package_symbol('$AUTHORITY')}; } sub identifier {