05 Jul 2022 18:08:58 UTC
- Distribution: Mite
- Module version: 0.005000
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (168 / 2 / 0)
- KwaliteeBus factor: 1
- 54.43% Coverage
- License: perl_5
- Perl: v5.10.1
- Download (75.7KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:3 non-PAUSE users
- WHY IS THIS
- SEE ALSO
- COPYRIGHT AND LICENCE
- DISCLAIMER OF WARRANTIES
Mite - Moose-like OO, fast to load, with zero dependencies.
Start a project:
$ mite init Foo
Write a class:
$ cat lib/Foo.pm package Foo; # Load the Mite shim use Foo::Mite; # Subclass of Bar extends "Bar"; # A read/write string attribute has attribute => ( is => 'rw', ); # A read-only attribute with a default has another_attribute => ( is => 'ro', default => 1, );
Compile your project:
$ mite compile
Use your project:
$ perl -Ilib -MFoo -E'say Foo->new->another_attribute'
Mite provides a subset of Moose features with very fast startup time and zero dependencies.
Mite provides Moose-like functionality, but it does all the work during development. New source code is written which contains the OO code. Your project does not have to depend on Mite. Nor does your project have to spend time during startup to build OO features.
Mite writes pure Perl code and your module will run with no dependencies. It will also write code to use other, faster modules to do the same job, if available.
These optimizations can be turned off by setting the
MITE_PURE_PERLenvironment variable true.
You may wish to add these as recommended dependencies.
Mite will use Class::XSAccessor for accessors if available. They are significantly faster than those written in Perl.
This module exists for a very special set of use cases. Authors of toolchain modules (Test::More, ExtUtils::MakeMaker, File::Spec, etc...) who cannot easily depend on other CPAN modules. It would cause a circular dependency and add instability to CPAN. These authors are frustrated at not being able to use most of the advances in Perl present on CPAN, such as Moose.
To add to their burden, by being used by almost everyone, toolchain modules limit how fast modules can load. So they have to compile very fast. They do not have the luxury of creating attributes and including roles at compile time. It must be baked in.
Use Mite if your project cannot have non-core dependencies or needs to load very quickly.
Please report any bugs to https://github.com/tobyink/p5-mite/issues.
Mite::Manual::Workflow - how to develop with Mite.
Mite::Manual::Syntax - Moose-like syntax supported by Mite.
Mite::Manual::Missing - Moose features not supported by Mite.
https://metacpan.org/dist/Acme-Mitey-Cards - demo project.
Moose is the complete Perl 5 OO module which this is all based on.
Moo is a lighter-weight Moose-compatible module with fewer dependencies.
Michael G Schwern <firstname.lastname@example.org>.
Toby Inkster <email@example.com>.
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.
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|