{
my $trace = '';
- my $method = Class::MOP::Method->wrap(sub { $trace .= 'primary' });
+ my $method = Class::MOP::Method->wrap(
+ body => sub { $trace .= 'primary' },
+ package_name => 'main',
+ name => '__ANON__',
+ );
isa_ok($method, 'Class::MOP::Method');
$method->();
# test around method
{
- my $method = Class::MOP::Method->wrap(sub { 4 });
+ my $method = Class::MOP::Method->wrap(
+ sub { 4 },
+ package_name => 'main',
+ name => '__ANON__',
+ );
isa_ok($method, 'Class::MOP::Method');
is($method->(), 4, '... got the right value from the wrapped method');
{
my @tracelog;
- my $method = Class::MOP::Method->wrap(sub { push @tracelog => 'primary' });
+ my $method = Class::MOP::Method->wrap(
+ sub { push @tracelog => 'primary' },
+ package_name => 'main',
+ name => '__ANON__',
+ );
isa_ok($method, 'Class::MOP::Method');
my $wrapped = Class::MOP::Method::Wrapped->wrap($method);