remove_method
add_attribute
remove_attribute
- add_package_symbol
remove_package_symbol
/],
memoize => {
compute_all_applicable_attributes => 'ARRAY',
get_meta_instance => 'SCALAR',
get_method_map => 'SCALAR',
- }
+ },
+ around => {
+ add_package_symbol => sub {
+ my $original = shift;
+ confess "NO ADD SYMBOLS FOR YOU" unless caller eq 'get_package_symbol';
+ $original->(@_);
+ },
+ },
});
return $class;
}
use Carp 'confess';
use Scalar::Util 'blessed';
+use Sub::Name 'subname';
our $VERSION = '0.05';
our $AUTHORITY = 'cpan:STEVAN';
$methods{$method_name} = sub { $_[0]->{'___' . $method_name} };
}
}
+
+ my $around_methods = $self->options->{around};
+ foreach my $method_name (keys %{$around_methods}) {
+ my $method = $self->metaclass->meta->find_method_by_name($method_name);
+ $method = Class::MOP::Method::Wrapped->wrap($method);
+ $method->add_around_modifier(subname ':around' => $around_methods->{$method_name});
+ }
$methods{get_mutable_metaclass_name} = sub { (shift)->{'___original_class'} };
use strict;
use warnings;
-use Test::More tests => 83;
+use Test::More tests => 84;
use Test::Exception;
BEGIN {
dies_ok { $meta->add_package_symbol() } '... exception thrown as expected';
dies_ok { $meta->remove_package_symbol() } '... exception thrown as expected';
+ lives_ok{ $meta->identifier() } '... no exception for get_package_symbol special case';
my @supers;
lives_ok {