DECLARE_KEY(insertion_order),
DECLARE_KEY(instance_metaclass),
DECLARE_KEY(is_inline),
+ DECLARE_KEY(is_stub),
DECLARE_KEY(method_metaclass),
DECLARE_KEY(methods),
DECLARE_KEY(name),
is( $method->original_fully_qualified_name, 'main::__ANON__',
'... the original_fully_qualified_name is the same as fully_qualified_name'
);
+ok( !$method->is_stub,
+ '... the method is not a stub' );
isnt( exception { Class::MOP::Method->wrap }, undef, q{... can't call wrap() without some code} );
isnt( exception { Class::MOP::Method->wrap( [] ) }, undef, q{... can't call wrap() without some code} );
my $wrapped2 = Method::Subclass->wrap($method, foo => 'baz', name => 'FOO');
is($wrapped2->name, 'FOO', 'got a new method name');
+{
+ package Foo;
+
+ sub full {1}
+ sub stub;
+}
+
+{
+ my $meta = Class::MOP::Class->initialize('Foo');
+
+ ok( $meta->has_method($_), "Foo class has $_ method" )
+ for qw( full stub );
+
+ my $full = $meta->get_method('full');
+ ok( !$full->is_stub, 'full is not a stub' );
+
+ my $stub = $meta->get_method('stub');
+
+ ok( $stub->is_stub, 'stub is a stub' );
+}
+
done_testing;
INSTALL_SIMPLE_READER(Method, name);
INSTALL_SIMPLE_READER(Method, package_name);
INSTALL_SIMPLE_READER(Method, body);
+
+bool
+is_stub(self)
+ SV *self
+
+ PREINIT:
+ CV *const body = (CV *)SvRV( HeVAL( hv_fetch_ent((HV *)SvRV(self), KEY_FOR(body), 0, HASH_FOR(body)) ) );
+
+ CODE:
+ RETVAL = !( CvISXSUB(body) || CvROOT(body) );
+
+ OUTPUT:
+ RETVAL