MOP::Util - For MOP External Use Only
version 0.11
This is a public API of MOP related utility functions.
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.
$package
@ISA
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.
$meta
@DOES
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.
defer_until_UNITCHECK( $cb )
Given a CODE reference, this will defer the execution of that $cb until the next available UNITCHECK phase.
$cb
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.
Stevan Little <stevan@cpan.org>
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.
To install MOP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MOP
CPAN shell
perl -MCPAN -e shell install MOP
For more information on module installation, please visit the detailed CPAN module installation guide.