- Fix _concrete_methods_of returning non-CODE entries
- fix broken implementation of method conflict resolution
(Perlmonks#1041015)
+ - add is_role method for checking if a given package is a role
1.002005 - 2013-02-01
- complain loudly if Class::Method::Modifiers is too old (and skip tests)
return 0;
}
+sub is_role {
+ my ($me, $role) = @_;
+ return !!$INFO{$role};
+}
+
1;
=encoding utf-8
Creates a new class based on base, with the roles composed into it in order.
New class is returned.
+=head2 is_role
+
+ Role::Tiny->is_role('Some::Role1')
+
+Returns true if the given package is a role.
+
=head1 SEE ALSO
L<Role::Tiny> is the attribute-less subset of L<Moo::Role>; L<Moo::Role> is
isa_ok($new_class, 'MyClass');
is($new_class->extra1, 'role extra', 'method from role');
+ok(Role::Tiny->is_role('MyRole'), 'is_role true for roles');
+ok(!Role::Tiny->is_role('MyClass'), 'is_role false for classes');
+
+
done_testing;