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

NAME

Exporter::TypeTiny - a small exporter used internally by Type::Library and friends

DESCRIPTION

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.

Its internal-facing interface is closer to Exporter.pm, with configuration done through the @EXPORT, @EXPORT_OK and %EXPORT_TAGS package variables.

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.

Functions

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_hash(\@array)

Similar to mkopt_hash from Data::OptList. See also mkopt.

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny.

SEE ALSO

Type::Library.

Exporter, Sub::Exporter, Sub::Exporter::Progressive.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

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.

DISCLAIMER OF WARRANTIES

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.