Mite::Manual::MOP - integration with the Moose Meta-Object Protocol.
To enable Moose integration, you need to provide a "mop" setting in your .mite/config file:
--- project: Your::Project source_from: lib compiled_to: lib shim: Your::Project::Shim mop: Your::Project::MOP types: Your::Project::Types perltidy: 1
Then when mite compile is run, Mite will write a bunch of metadata about your classes and roles to lib/Your/Project/MOP.pm.
mite compile
Now your project has Moose-compatibility!
Loading Your::Project::MOP will instantly "promote" all your classes and roles to Moose classes and roles.
Your::Project::MOP
Third parties can now use Moose to extend your project.
package Third::Party::Widget; use Your::Project::MOP; use Moose; extends 'Your::Project::Widget'; has sku => ( is => 'ro', isa => 'Str' ); __PACKAGE__->meta->make_immutable;
If you decide to enable Moose integration for your project, it will still have zero non-core dependencies for normal usage, but loading the MOP.pm file will require Moose and Type::Tiny, plus any type libraries you used (such as Types::Standard, Types::Common::String, and Types::Common::Numeric).
Just try to make sure that in normal usage MOP.pm never gets loaded.
meta
If Moose integration is enabled, all your classes and roles will have a meta method, similar to the one provided by Moose.
Calling $class->meta, $role->meta, or $object->meta on any of your Mite classes/roles/objects will load MOP.pm.
$class->meta
$role->meta
$object->meta
Please report any bugs to https://github.com/tobyink/p5-mite/issues.
Michael G Schwern <mschwern@cpan.org>.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2011-2014 by Michael G Schwern.
This software is copyright (c) 2022 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install Mite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mite
CPAN shell
perl -MCPAN -e shell install Mite
For more information on module installation, please visit the detailed CPAN module installation guide.