Exporter::TypeTiny - a small exporter used internally by Type::Library and friends
Y O Y O Y O Y O Y ???
Why bundle an exporter with Type-Tiny?
Well, it wasn't always that way. Type::Library had a bunch of custom exporting code which poked coderefs into its caller's stash. It needed this so that it could switch between exporting Moose, Mouse and Moo-compatible objects on request.
Meanwhile Type::Utils, Types::TypeTiny and Test::TypeTiny each used the venerable Exporter.pm. However, this meant they were unable to use the features like Sub::Exporter-style function renaming which I'd built into Type::Library:
## import "Str" but rename it to "String". use Types::Standard "Str" => { -as => "String" };
And so I decided to factor out code that could be shared by all Type-Tiny's exporters into a single place.
Exporter::TypeTiny supports many of Sub::Exporter's external-facing features including renaming imported functions with the -as, -prefix and -suffix options; explicit destinations with the into option; and alternative installers with the installler option. But it's written in only about 40% as many lines of code and has with zero non-core dependencies.
-as
-prefix
-suffix
into
installler
Its internal-facing interface is closer to Exporter.pm, with configuration done through the @EXPORT, @EXPORT_OK and %EXPORT_TAGS package variables.
@EXPORT
@EXPORT_OK
%EXPORT_TAGS
Although builders are not an explicit part of the interface, Exporter::TypeTiny performs most of its internal duties (including resolution of tag names to function names, resolution of function names to coderefs, and installation of coderefs into the target package) as method calls, which means they can be overridden to provide interesting behaviour. These are not currently documented, and are still subject to change.
These are really for internal use, but can be exported if you need them.
mkopt(\@array)
Similar to mkopt from Data::OptList. It doesn't support all the fancy options that Data::OptList does (moniker, require_unique, must_be and name_test) but runs about 50% faster.
mkopt
moniker
require_unique
must_be
name_test
mkopt_hash(\@array)
Similar to mkopt_hash from Data::OptList. See also mkopt.
mkopt_hash
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny.
Type::Library.
Exporter, Sub::Exporter, Sub::Exporter::Progressive.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2013 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 LIMITAerTION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install Type::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Type::Tiny
CPAN shell
perl -MCPAN -e shell install Type::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.