The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MOP::Util - For MOP External Use Only

VERSION

version 0.11

DESCRIPTION

This is a public API of MOP related utility functions.

METHODS

get_meta( $package )

This will guess the most sensible type of meta object to represent the $package supplied. The test is simple, if there is anything in the @ISA array within $package, then it is clearly a class and therefore returns a MOP::Class instance. However, if there is nothing in @ISA we conservatively estimate that this is a role and return a MOP::Role instance.

In pretty much all cases that matter, a role and a class are entirely interchangable.

compose_roles( $meta )

This will look to see if the $meta object has any roles stored in it's @DOES array, if so it will compose the roles together and apply that result to $meta.

Note, if this is called more than once, the results are undefined.

inherit_slots( $meta )

This will look to see if the $meta object is a MOP::Class instance and if so, will then loop through the direct superclasses (thouse in the @ISA array of $meta) and alias all the slots into the $meta namespace.

Note, if this is called more than once, the results are undefined.

defer_until_UNITCHECK( $cb )

Given a CODE reference, this will defer the execution of that $cb until the next available UNITCHECK phase.

Note, it is not receommended to heavily abuse closures here, it might get messy, might not, better to keep it clean and just not go there.

AUTHOR

Stevan Little <stevan@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Stevan Little.

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