Valiant::Util::Ancestors - Detect 'ancestors' of the class (via Roles or Inheritance)


    package Example::Object

    use Moo;

    with 'MooX::MetaDescription::Ancestors';



This really isn't intended for direct consumption. Basically it exists because there's not official way in Moo to get a list of the roles which have been applied to a given class. Since I need to know this in order to lookup and aggregate meta descriptions from any roles that have been applied, this is the best hack I could come up with. It's ugly. Suggestions welcomed (or convince MST we need an offical way to get all the applied roles to a Moo class).

Yes I could translate this whole thing to Moose I suppose and then I could get a real MOP. Maybe I should do that. Conversation welcomed.


This component adds the following methods to your result classes.


This returns an array of all the roles and your @ISA list. There is no promise in the order given. You get the @ISA list and the roles are tacked onto the end. Don't use this for anything where you care about the order of application of the roles. Also, this might change at some point. I really have no specific need for ordering at this point to be anything in particular but that could change.


John Napiorkowski




Copyright 2020, John Napiorkowski

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.