COPYRIGHT000664001750001750 271513110543466 14565 0ustar00taitai000000000000Exporter-Tiny-1.000000Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Exporter-Tiny Upstream-Contact: Toby Inkster (TOBYINK) Source: https://metacpan.org/release/Exporter-Tiny Files: README lib/Exporter/Tiny.pm lib/Exporter/Tiny/Manual/Etc.pod lib/Exporter/Tiny/Manual/Exporting.pod lib/Exporter/Tiny/Manual/Importing.pod lib/Exporter/Tiny/Manual/QuickStart.pod t/01basic.t t/02renaming.t t/03generators.t t/04into.t Copyright: This software is copyright (c) 2013-2014, 2017 by Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: COPYRIGHT CREDITS Changes INSTALL LICENSE META.json META.yml Makefile.PL doap.ttl Copyright: Copyright 2017 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: lib/Exporter/Shiny.pm t/05shiny.t t/06notwant.t t/07regexp.t t/08tags.t t/09warnings.t t/10no.t Copyright: This software is copyright (c) 2014, 2017 by Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: dist.ini examples/Example/Exporter.pm Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: SIGNATURE Copyright: None License: public-domain License: Artistic-1.0 This software is Copyright (c) 2017 by the copyright holder(s). This is free software, licensed under: The Artistic License 1.0 License: GPL-1.0 This software is Copyright (c) 2017 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000664001750001750 15113110543465 14261 0ustar00taitai000000000000Exporter-Tiny-1.000000Maintainer: - Toby Inkster (TOBYINK) Thanks: - CHOCOLATEBOY Changes000664001750001750 525413110543465 14565 0ustar00taitai000000000000Exporter-Tiny-1.000000Exporter-Tiny ============= Created: 2013-09-05 Home page: Bug tracker: Maintainer: Toby Inkster (TOBYINK) 1.000000 2017-05-22 [ Packaging ] - Repackage as 1.000000. 0.044 2017-01-30 [ Packaging ] - Repackage as a stable release. 0.043_02 2017-01-30 [ Packaging ] - Release using newer versions of toolchain stuff. 0.043_01 2014-11-09 [ Documentation ] - Restructure documentation. [ Other ] - Support { -as => CODE } to programatically rename functions. 0.042 2014-10-04 [ Documentation ] - Document the warning emitted when you provide options to a function you are unimporting. [ Other ] - Housekeeping on %TRACKED. 0.041_02 2014-09-19 [ Bug Fixes ] - Option validation needs to happen after expanding tags. 0.041_01 2014-09-18 - Add an `unimport` feature. 0.040 2014-09-17 [ Packaging ] - Repackage as a stable release. 0.039_01 2014-07-20 [ Documentation ] - Document warning and error messages produced by Exporter::Tiny. [ Other ] - Exporter::Tiny would previously cause B.pm to be loaded into memory any time it exported anything. It no longer does. - No longer die when redefining locally defined subs. - Warn when redefining any subs. 0.038 2014-04-04 0.037_03 2014-04-02 [ Bug Fixes ] - Only attempt to merge hashes if we're sure they're both really hashes! 0.037_02 2014-04-02 - Improved handling of hashrefs of options passed to tags, and hashrefs of options found within %EXPORT_TAGS arrayrefs. 0.037_01 2014-03-26 [ Documentation ] - Fix minor error in documentation of generators. [ Other ] - Added: Support Exporter.pm's import negation syntax qw( !foo ). - Added: Support Exporter.pm's regexp import syntax qw( /foo/ ). 0.036 2014-03-11 0.035_02 2014-03-01 [ Documentation ] - Document exactly what Exporter::Shiny is supposed to do. [ Test Suite ] - Make t/02renaming.t less noisy. 0.035_01 2014-03-01 [ Packaging ] - Explicitly list minimum Perl version: 5.6.1. 0.034 2014-01-19 0.033_01 2014-01-19 - Added: Add a new wrapper module called Exporter::Shiny. 0.032 2013-12-30 0.031_01 2013-12-30 [ Test Suite ] - No longer require a recent version of Test::More; the Test::More bundled with Perl 5.6.2 should suffice. 0.030 2013-09-26 [ Test Suite ] - Test for the 'into' option. 0.029_01 2013-09-26 [ Documentation ] - Exporter::TypeTiny is being retired, so modify documentation and distribution metadata for Exporter::Tiny to no longer point there. 0.026 2013-09-05 Initial release [ Packaging ] - Split Exporter::Tiny out from Exporter::TypeTiny. CHOCOLATEBOY++ INSTALL000664001750001750 167713110543465 14330 0ustar00taitai000000000000Exporter-Tiny-1.000000 Installing Exporter-Tiny should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm Exporter::Tiny If you are installing into a system-wide directory, you may need to pass the "-S" flag to cpanm, which uses sudo to install the module: % cpanm -S Exporter::Tiny INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan Exporter::Tiny MANUAL INSTALLATION As a last resort, you can manually install it. Download the tarball and unpack it. Consult the file META.json for a list of pre-requisites. Install these first. To build Exporter-Tiny: % perl Makefile.PL % make && make test Then install it: % make install If you are installing into a system-wide directory, you may need to run: % sudo make install LICENSE000664001750001750 4365513110543465 14326 0ustar00taitai000000000000Exporter-Tiny-1.000000This software is copyright (c) 2017 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. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2017 by Toby Inkster. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2017 by Toby Inkster. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. 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. The End MANIFEST000664001750001750 72513110543466 14402 0ustar00taitai000000000000Exporter-Tiny-1.000000COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl examples/Example/Exporter.pm lib/Exporter/Shiny.pm lib/Exporter/Tiny.pm lib/Exporter/Tiny/Manual/Etc.pod lib/Exporter/Tiny/Manual/Exporting.pod lib/Exporter/Tiny/Manual/Importing.pod lib/Exporter/Tiny/Manual/QuickStart.pod t/01basic.t t/02renaming.t t/03generators.t t/04into.t t/05shiny.t t/06notwant.t t/07regexp.t t/08tags.t t/09warnings.t t/10no.t META.json000664001750001750 376313110543466 14717 0ustar00taitai000000000000Exporter-Tiny-1.000000{ "abstract" : "an exporter with the features of Sub::Exporter but only core dependencies", "author" : [ "Toby Inkster (TOBYINK) " ], "dynamic_config" : 1, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.024, CPAN::Meta::Converter version 2.150005", "keywords" : [], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Exporter-Tiny", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "runtime" : { "requires" : { "perl" : "5.006001" } }, "test" : { "recommends" : { "Test::Fatal" : "0", "Test::Warnings" : "0" }, "requires" : { "Test::More" : "0.47" } } }, "provides" : { "Exporter::Shiny" : { "file" : "lib/Exporter/Shiny.pm", "version" : "1.000000" }, "Exporter::Tiny" : { "file" : "lib/Exporter/Tiny.pm", "version" : "1.000000" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://rt.cpan.org/Dist/Display.html?Queue=Exporter-Tiny" }, "homepage" : "https://metacpan.org/release/Exporter-Tiny", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/tobyink/p5-exporter-tiny.git", "web" : "https://github.com/tobyink/p5-exporter-tiny" }, "x_IRC" : "irc://irc.perl.org/#moops", "x_identifier" : "http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/project" }, "version" : "1.000000", "x_serialization_backend" : "JSON::PP version 2.27300_01" } META.yml000664001750001750 224613110543466 14542 0ustar00taitai000000000000Exporter-Tiny-1.000000--- abstract: 'an exporter with the features of Sub::Exporter but only core dependencies' author: - 'Toby Inkster (TOBYINK) ' build_requires: Test::More: '0.47' configure_requires: ExtUtils::MakeMaker: '6.17' dynamic_config: 1 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.024, CPAN::Meta::Converter version 2.150005' keywords: [] license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Exporter-Tiny no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: Exporter::Shiny: file: lib/Exporter/Shiny.pm version: '1.000000' Exporter::Tiny: file: lib/Exporter/Tiny.pm version: '1.000000' requires: perl: '5.006001' resources: IRC: irc://irc.perl.org/#moops Identifier: http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/project bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=Exporter-Tiny homepage: https://metacpan.org/release/Exporter-Tiny license: http://dev.perl.org/licenses/ repository: git://github.com/tobyink/p5-exporter-tiny.git version: '1.000000' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Makefile.PL000664001750001750 1223213110543466 15257 0ustar00taitai000000000000Exporter-Tiny-1.000000use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "an exporter with the features of Sub::Exporter but only core dependencies", "author" => ["Toby Inkster (TOBYINK) "], "dynamic_config" => 1, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.024, CPAN::Meta::Converter version 2.150005", "keywords" => [], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "Exporter-Tiny", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, runtime => { requires => { perl => 5.006001 } }, test => { recommends => { "Test::Fatal" => 0, "Test::Warnings" => 0 }, requires => { "Test::More" => 0.47 }, }, }, "provides" => { "Exporter::Shiny" => { file => "lib/Exporter/Shiny.pm", version => "1.000000" }, "Exporter::Tiny" => { file => "lib/Exporter/Tiny.pm", version => "1.000000" }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "http://rt.cpan.org/Dist/Display.html?Queue=Exporter-Tiny", }, homepage => "https://metacpan.org/release/Exporter-Tiny", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", url => "git://github.com/tobyink/p5-exporter-tiny.git", web => "https://github.com/tobyink/p5-exporter-tiny", }, x_identifier => "http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/project", x_IRC => "irc://irc.perl.org/#moops", }, "version" => "1.000000", }; my %dynamic_config; do { # idk, this should be automatic or summint? put it in explicitly. $meta->{prereqs}{runtime}{requires}{'Test::More'} = '0.47' if $] < 5.006002; }; my %WriteMakefileArgs = ( ABSTRACT => $meta->{abstract}, AUTHOR => ($EUMM >= 6.5702 ? $meta->{author} : $meta->{author}[0]), DISTNAME => $meta->{name}, VERSION => $meta->{version}, EXE_FILES => [ map $_->{file}, values %{ $meta->{x_provides_scripts} || {} } ], NAME => do { my $n = $meta->{name}; $n =~ s/-/::/g; $n }, test => { TESTS => "t/*.t" }, %dynamic_config, ); $WriteMakefileArgs{LICENSE} = $meta->{license}[0] if $EUMM >= 6.3001; sub deps { my %r; for my $stage (@_) { for my $dep (keys %{$meta->{prereqs}{$stage}{requires}}) { next if $dep eq 'perl'; my $ver = $meta->{prereqs}{$stage}{requires}{$dep}; $r{$dep} = $ver if !exists($r{$dep}) || $ver >= $r{$dep}; } } \%r; } my ($build_requires, $configure_requires, $runtime_requires, $test_requires); if ($EUMM >= 6.6303) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{TEST_REQUIRES} ||= deps('test'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.5503) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build', 'test'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.52) { $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime', 'build', 'test'); } else { $WriteMakefileArgs{PREREQ_PM} ||= deps('configure', 'build', 'test', 'runtime'); } { my ($minperl) = reverse sort( grep defined && /^[0-9]+(\.[0-9]+)?$/, map $meta->{prereqs}{$_}{requires}{perl}, qw( configure build runtime ) ); if (defined($minperl)) { die "Installing $meta->{name} requires Perl >= $minperl" unless $] >= $minperl; $WriteMakefileArgs{MIN_PERL_VERSION} ||= $minperl if $EUMM >= 6.48; } } sub FixMakefile { return unless -d 'inc'; my $file = shift; local *MAKEFILE; open MAKEFILE, "< $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; my $makefile = do { local $/; }; close MAKEFILE or die $!; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; open MAKEFILE, "> $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; print MAKEFILE $makefile or die $!; close MAKEFILE or die $!; } my $mm = WriteMakefile(%WriteMakefileArgs); FixMakefile($mm->{FIRST_MAKEFILE} || 'Makefile'); exit(0); README000664001750001750 406013110543465 14144 0ustar00taitai000000000000Exporter-Tiny-1.000000NAME Exporter::Tiny - an exporter with the features of Sub::Exporter but only core dependencies SYNOPSIS package MyUtils; use base "Exporter::Tiny"; our @EXPORT = qw(frobnicate); sub frobnicate { ... } 1; package MyScript; use MyUtils "frobnicate" => { -as => "frob" }; print frob(42); exit; DESCRIPTION Exporter::Tiny 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 `installer` option. But it's written in only about 40% as many lines of code and 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. If you are trying to write a module that inherits from Exporter::Tiny, then look at: * Exporter::Tiny::Manual::QuickStart * Exporter::Tiny::Manual::Exporting If you are trying to use a module that inherits from Exporter::Tiny, then look at: * Exporter::Tiny::Manual::Importing BUGS Please report any bugs to . SUPPORT IRC: support is available through in the *#moops* channel on irc.perl.org . SEE ALSO Simplified interface to this module: Exporter::Shiny. Other interesting exporters: Sub::Exporter, Exporter. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017 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 LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. SIGNATURE000664001750001750 471413110543467 14560 0ustar00taitai000000000000Exporter-Tiny-1.000000This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.81. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 58970c16dff93a4e1d6e8c405c5bc8188be49799 COPYRIGHT SHA1 e3b0c464bb56d4285fa64e31a70b301692dd825c CREDITS SHA1 0e8eebbb4ee5e34fb15e90510bdf54d53a539c3c Changes SHA1 3b20e9835f489bbf71b1deb6aa7c10729482aa77 INSTALL SHA1 c4c1e6c578edcfd14d13eadebc8f56dd9ca46821 LICENSE SHA1 97bc2eb47523ed9f03f47271b29959b1f3edce24 MANIFEST SHA1 d262494ba318b185a27a034e950663303120ed94 META.json SHA1 5ae4c8c6bbdeb24edd37b2024ec4139be090a7a1 META.yml SHA1 9d43607022577d07f3a2df4494a4f743809d2f9e Makefile.PL SHA1 2d5592860cac601d95b1a00863f3b4fc29639d2f README SHA1 a43593d3e3a79c5f455977ba75083d9f191f6af6 dist.ini SHA1 0fdb2b1f95a4562ece610412c6c78cc7e6a2adc2 doap.ttl SHA1 3f65666b300ab7e7a1e5e25fb69e4ce6675e0f63 examples/Example/Exporter.pm SHA1 4b548adad97a2f9a52c6d691af847f829e850684 lib/Exporter/Shiny.pm SHA1 fc49e39bcb17b8124912d64f43c52c2db4a2a08e lib/Exporter/Tiny.pm SHA1 0e4aab8c35fbbdb9f7d7bad7ca0b09dbdcf49622 lib/Exporter/Tiny/Manual/Etc.pod SHA1 5d0f275559385cbd4fe9da7b5d815af5d65151ef lib/Exporter/Tiny/Manual/Exporting.pod SHA1 6c9e12d234866ef242447be427583ea4cdba85a9 lib/Exporter/Tiny/Manual/Importing.pod SHA1 d3490992563cb4fc178b9d1da0a7449a1f726560 lib/Exporter/Tiny/Manual/QuickStart.pod SHA1 634706978c1b96226b35b763bfec74602303dbc6 t/01basic.t SHA1 287d93a6d4ea7364f251dfabc18f49911eb34278 t/02renaming.t SHA1 25a63815d24aff25751dc194be0c4cc950c47104 t/03generators.t SHA1 99b8cbf69c65338c0b502b0351b5580c306235f3 t/04into.t SHA1 db0c8bf9facceb64971e5eeebd6592508d9335dd t/05shiny.t SHA1 f97e9d2cb58bf5fab88585a2b215c2840c129b00 t/06notwant.t SHA1 db742ca2aac48c6fa0fb167796726d520f00d49b t/07regexp.t SHA1 1f08eb2996c19c4f85483d9b66d0223dd3da80f1 t/08tags.t SHA1 57670cc5578a2aaf3932c18bf2c379b710229675 t/09warnings.t SHA1 11c0f79936b27cfd46bf5f27c1e8cb7455a6463f t/10no.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlkixzcACgkQzr+BKGoqfTk6UQCeKkh68lWNgfAXaP8c63pASGhD A9UAoI5BKRLBiajpluddNiiXxqvuIS+A =fuCC -----END PGP SIGNATURE----- dist.ini000664001750001750 7713110543465 14674 0ustar00taitai000000000000Exporter-Tiny-1.000000;;class='Dist::Inkt::Profile::TOBYINK' ;;name='Exporter-Tiny' doap.ttl000664001750001750 5317413110543466 14767 0ustar00taitai000000000000Exporter-Tiny-1.000000@prefix cpan-uri: . @prefix dc: . @prefix doap: . @prefix doap-changeset: . @prefix doap-deps: . @prefix foaf: . @prefix nfo: . @prefix rdfs: . @prefix xsd: . dc:title "the same terms as the perl 5 programming language system itself". a doap:Project; cpan-uri:x_IRC ; dc:contributor ; doap-deps:runtime-requirement [ doap-deps:on "perl 5.006001"^^doap-deps:CpanId ]; doap-deps:test-recommendation [ doap-deps:on "Test::Fatal"^^doap-deps:CpanId ], [ doap-deps:on "Test::Warnings"^^doap-deps:CpanId ]; doap-deps:test-requirement [ doap-deps:on "Test::More 0.47"^^doap-deps:CpanId ]; doap:bug-database ; doap:created "2013-09-05"^^xsd:date; doap:developer ; doap:download-page ; doap:homepage ; doap:license ; doap:maintainer ; doap:name "Exporter-Tiny"; doap:programming-language "Perl"; doap:release , , , , , , , , , , , , , , , , , , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; ]; doap:shortdesc "an exporter with the features of Sub::Exporter but only core dependencies"; rdfs:seeAlso . a doap:Version; rdfs:label "Initial release"; dc:identifier "Exporter-Tiny-0.026"^^xsd:string; dc:issued "2013-09-05"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Split Exporter::Tiny out from Exporter::TypeTiny."; doap-changeset:thanks ; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.026"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.029_01"^^xsd:string; dc:issued "2013-09-26"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation, doap-changeset:Packaging; rdfs:label "Exporter::TypeTiny is being retired, so modify documentation and distribution metadata for Exporter::Tiny to no longer point there."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.029_01"^^xsd:string. a doap:Version; dc:identifier "Exporter-Tiny-0.030"^^xsd:string; dc:issued "2013-09-26"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Tests; rdfs:label "Test for the 'into' option."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.030"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.031_01"^^xsd:string; dc:issued "2013-12-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging, doap-changeset:Tests; rdfs:label "No longer require a recent version of Test::More; the Test::More bundled with Perl 5.6.2 should suffice."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.031_01"^^xsd:string. a doap:Version; dc:identifier "Exporter-Tiny-0.032"^^xsd:string; dc:issued "2013-12-30"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.032"^^xsd:string; rdfs:comment "No functional changes since 0.031_01.". a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.033_01"^^xsd:string; dc:issued "2014-01-19"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Add a new wrapper module called Exporter::Shiny."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.033_01"^^xsd:string. a doap:Version; dc:identifier "Exporter-Tiny-0.034"^^xsd:string; dc:issued "2014-01-19"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.034"^^xsd:string; rdfs:comment "No functional changes since 0.033_01.". a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.035_01"^^xsd:string; dc:issued "2014-03-01"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Explicitly list minimum Perl version: 5.6.1."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.035_01"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.035_02"^^xsd:string; dc:issued "2014-03-01"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Document exactly what Exporter::Shiny is supposed to do."; ], [ a doap-changeset:Tests; rdfs:label "Make t/02renaming.t less noisy."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.035_02"^^xsd:string. a doap:Version; dc:identifier "Exporter-Tiny-0.036"^^xsd:string; dc:issued "2014-03-11"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.036"^^xsd:string; rdfs:comment "No functional changes since 0.035_02.". a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.037_01"^^xsd:string; dc:issued "2014-03-26"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Fix minor error in documentation of generators."; ], [ a doap-changeset:Addition; rdfs:label "Support Exporter.pm's import negation syntax qw( !foo )."; ], [ a doap-changeset:Addition; rdfs:label "Support Exporter.pm's regexp import syntax qw( /foo/ )."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.037_01"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.037_02"^^xsd:string; dc:issued "2014-04-02"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Improved handling of hashrefs of options passed to tags, and hashrefs of options found within %EXPORT_TAGS arrayrefs."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.037_02"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.037_03"^^xsd:string; dc:issued "2014-04-02"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Only attempt to merge hashes if we're sure they're both really hashes!"; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.037_03"^^xsd:string. a doap:Version; dc:identifier "Exporter-Tiny-0.038"^^xsd:string; dc:issued "2014-04-04"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.038"^^xsd:string; rdfs:comment "No functional changes since 0.037_03.". a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.039_01"^^xsd:string; dc:issued "2014-07-20"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Document warning and error messages produced by Exporter::Tiny."; ], [ a doap-changeset:Change; rdfs:label "No longer die when redefining locally defined subs."; ], [ a doap-changeset:Change; rdfs:label "Warn when redefining any subs."; ], [ a doap-changeset:Change; rdfs:label "Exporter::Tiny would previously cause B.pm to be loaded into memory any time it exported anything. It no longer does."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.039_01"^^xsd:string. a doap:Version; dc:identifier "Exporter-Tiny-0.040"^^xsd:string; dc:issued "2014-09-17"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Repackage as a stable release."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.040"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.041_01"^^xsd:string; dc:issued "2014-09-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Add an `unimport` feature."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.041_01"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.041_02"^^xsd:string; dc:issued "2014-09-19"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Option validation needs to happen after expanding tags."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.041_02"^^xsd:string. a doap:Version; dc:identifier "Exporter-Tiny-0.042"^^xsd:string; dc:issued "2014-10-04"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Document the warning emitted when you provide options to a function you are unimporting."; ], [ a doap-changeset:Change; rdfs:label "Housekeeping on %TRACKED."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.042"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.043_01"^^xsd:string; dc:issued "2014-11-09"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Restructure documentation."; ], [ a doap-changeset:Change; rdfs:label "Support { -as => CODE } to programatically rename functions."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.043_01"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; dc:identifier "Exporter-Tiny-0.043_02"^^xsd:string; dc:issued "2017-01-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Release using newer versions of toolchain stuff."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.043_02"^^xsd:string. a doap:Version; dc:identifier "Exporter-Tiny-0.044"^^xsd:string; dc:issued "2017-01-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Repackage as a stable release."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.044"^^xsd:string. a doap:Version; dc:identifier "Exporter-Tiny-1.000000"^^xsd:string; dc:issued "2017-05-22"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Repackage as 1.000000."; ]; doap-changeset:versus ; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "1.000000"^^xsd:string. a doap:Project; dc:contributor ; doap:download-page ; doap:homepage ; doap:name "Type-Tiny"; doap:programming-language "Perl"; doap:release . a doap:Version; dc:identifier "Type-Tiny-0.026"^^xsd:string; doap-changeset:released-by ; doap:file-release ; doap:revision "0.026"^^xsd:string. a foaf:Person; foaf:nick "CHOCOLATEBOY"; foaf:page . a foaf:Person; foaf:mbox ; foaf:name "Toby Inkster"; foaf:nick "TOBYINK"; foaf:page . [] a nfo:FileDataObject; dc:license ; dc:rightsHolder ; nfo:fileName "COPYRIGHT". [] a nfo:FileDataObject; dc:license ; dc:rightsHolder ; nfo:fileName "CREDITS". [] a nfo:FileDataObject, nfo:TextDocument; dc:license ; dc:rightsHolder ; nfo:fileName "INSTALL". [] a nfo:FileDataObject, nfo:TextDocument; dc:license ; dc:rightsHolder ; nfo:fileName "LICENSE". [] a nfo:FileDataObject, nfo:SourceCode; dc:license ; dc:rightsHolder ; nfo:fileName "Makefile.PL"; nfo:programmingLanguage "Perl". [] a nfo:FileDataObject, nfo:SourceCode; dc:license ; dc:rightsHolder ; nfo:fileName "examples/Example/Exporter.pm"; nfo:programmingLanguage "Perl". 01basic.t000664001750001750 131613110543465 15137 0ustar00taitai000000000000Exporter-Tiny-1.000000/t=pod =encoding utf-8 =head1 PURPOSE Very basic Exporter::Tiny test. Check that it allows us to import the functions named in C<< @EXPORT >>. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017 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. =cut use strict; use warnings; use Test::More tests => 2; use lib qw( examples ../examples ); use Example::Exporter; diag("Perl $]"); is fib(6), 8, 'Correctly imported "fib" from Example::Exporter'; ok !__PACKAGE__->can('embiggen'), 'Did not inadvertantly import "embiggen"'; 02renaming.t000664001750001750 245313110543465 15662 0ustar00taitai000000000000Exporter-Tiny-1.000000/t=pod =encoding utf-8 =head1 PURPOSE Check renaming imported functions. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017 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. =cut use strict; use warnings; use Test::More tests => 6; BEGIN { *note = *diag unless __PACKAGE__->can("note") }; use lib qw( examples ../examples ); note "Rename functions using -as"; do { package Local::AAA; use Example::Exporter fib => { -as => 'fibonacci' }; ::is fibonacci(6), 8, 'Correctly imported "fibonacci" from Example::Exporter'; ::ok !__PACKAGE__->can('fib'), 'Did not inadvertantly import "fib"'; }; note "Rename functions using -prefix"; do { package Local::BBB; use Example::Exporter fib => { -prefix => 'my' }; ::is myfib(6), 8, 'Correctly imported "myfib" from Example::Exporter'; ::ok !__PACKAGE__->can('fib'), 'Did not inadvertantly import "fib"'; }; note "Rename functions using -suffix"; do { package Local::CCC; use Example::Exporter fib => { -suffix => 'onacci' }; ::is fibonacci(6), 8, 'Correctly imported "fibonacci" from Example::Exporter'; ::ok !__PACKAGE__->can('fib'), 'Did not inadvertantly import "fib"'; }; 03generators.t000664001750001750 141213110543465 16226 0ustar00taitai000000000000Exporter-Tiny-1.000000/t=pod =encoding utf-8 =head1 PURPOSE Check renaming imported functions. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017 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. =cut use strict; use warnings; use Test::More tests => 4; use lib qw( examples ../examples ); use Example::Exporter embiggen => {}, embiggen => { -suffix => '_by_2', amount => 2 }, embiggen => { -suffix => '_by_42', amount => 42 }; is embiggen(10), 11, 'embiggen'; is embiggen_by_2(10), 12, 'embiggen_by_2'; is embiggen_by_42(10), 52, 'embiggen_by_42'; is prototype(\&embiggen), '$', 'correct prototype'; 04into.t000664001750001750 114213110543465 15027 0ustar00taitai000000000000Exporter-Tiny-1.000000/t=pod =encoding utf-8 =head1 PURPOSE Check the C<< -into >> option works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017 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. =cut use strict; use warnings; use Test::More tests => 2; use lib qw( examples ../examples ); { package Foo; use Example::Exporter { into => "Bar" }, qw( fib ); } { package Bar; } ok( not "Foo"->can("fib") ); ok( "Bar"->can("fib") ); 05shiny.t000664001750001750 107413110543465 15215 0ustar00taitai000000000000Exporter-Tiny-1.000000/t=pod =encoding utf-8 =head1 PURPOSE Very basic Exporter::Shiny test. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014, 2017 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. =cut use strict; use warnings; use Test::More tests => 1; { package Local::Foo; use Exporter::Shiny qw(foo bar); sub foo { return 42; } sub bar { return 666; } } use Local::Foo qw(foo); is(foo(), 42); 06notwant.t000664001750001750 121713110543465 15555 0ustar00taitai000000000000Exporter-Tiny-1.000000/t=pod =encoding utf-8 =head1 PURPOSE Test the C<< !notwant >> notation. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014, 2017 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. =cut use strict; use warnings; use Test::More tests => 1; { package Local::Foo; use Exporter::Shiny qw(foo bar); sub foo { return 42; } sub bar { return 666; } } my %imported; 'Local::Foo'->import({ into => \%imported }, qw( -all !foo )); is_deeply([sort keys %imported], ['bar']); 07regexp.t000664001750001750 142313110543465 15355 0ustar00taitai000000000000Exporter-Tiny-1.000000/t=pod =encoding utf-8 =head1 PURPOSE Test the C<< /regexp/ >> notation. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014, 2017 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. =cut use strict; use warnings; use Test::More tests => 2; { package Local::Foo; use Exporter::Shiny qw(foo bar); sub foo { return 42; } sub bar { return 666; } } { my %imported; 'Local::Foo'->import({ into => \%imported }, qw( /^F/i )); is_deeply([sort keys %imported], ['foo']); } { my %imported; 'Local::Foo'->import({ into => \%imported }, qw( -all !/^F/i )); is_deeply([sort keys %imported], ['bar']); } 08tags.t000664001750001750 240513110543465 15023 0ustar00taitai000000000000Exporter-Tiny-1.000000/t=pod =encoding utf-8 =head1 PURPOSE Test that tag expansion works sanely. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014, 2017 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. =cut use strict; use warnings; use Test::More tests => 7; BEGIN { package Local::Foo; use Exporter::Shiny qw(foo bar); our %EXPORT_TAGS = ( first => [ 'foo' => { xxx => 41 }, 'bar' ], second => [ 'foo', 'bar' ], upper => [ 'foo' => { -as => 'O', -prefix => 'F', -suffix => 'O' }, 'bar' => { -as => 'A', -prefix => 'B', -suffix => 'R' }, ], ); sub _generate_foo { my $me = shift; my ($name, $args) = @_; return sub () { $args->{xxx} }; } sub _generate_bar { my $me = shift; my ($name, $args) = @_; return sub () { $args->{xxx} }; } }; use Local::Foo -first => { -prefix => 'first_' }, -second => { -prefix => 'second_', xxx => 666 }, -first => { -prefix => 'third_', xxx => 42 }; is(first_foo, 41); is(first_bar, undef); is(second_foo, 666); is(second_bar, 666); is(third_foo, 42); is(third_bar, 42); use Local::Foo -upper => { -prefix => 'MY', xxx => 999 }; is(MYFOO, 999); 09warnings.t000664001750001750 302113110543465 15711 0ustar00taitai000000000000Exporter-Tiny-1.000000/t=pod =encoding utf-8 =head1 PURPOSE Test sub redefinition warnings/errors. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014, 2017 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. =cut use strict; use warnings; use Test::More; BEGIN { eval "use Test::Fatal; use Test::Warnings qw(warning :no_end_test); 1" or plan skip_all => "test requires Test::Warnings and Test::Fatal"; plan tests => 4; }; BEGIN { package Local::Exporter; use Exporter::Shiny qw(foo bar); sub foo { 666 } sub bar { 999 } }; like( warning { eval q{ package Local::Test1; sub foo { 42 } use Local::Exporter -all; 1; } }, qr/^Overwriting existing sub 'Local::Test1::foo' with sub 'foo' exported by Local::Exporter/, 'warning about overwriting sub', ); like( exception { eval q{ package Local::Test2; sub foo { 42 } use Local::Exporter { replace => 'die' }, -all; 1; } or die $@ }, qr/^Refusing to overwrite existing sub 'Local::Test2::foo' with sub 'foo' exported by Local::Exporter/, '... which can be fatalized', ); is_deeply( warning { eval q{ package Local::Test3; sub foo { 42 } use Local::Exporter { replace => 'die' }, -all; 1; } }, [], '... or suppressed', ); is_deeply( warning { eval q{ package Local::Test4; use Local::Exporter -all; use Local::Exporter qw(foo); 1; } }, [], 'but importing the exact same sub twice is OK', ); 10no.t000664001750001750 203113110543465 14465 0ustar00taitai000000000000Exporter-Tiny-1.000000/t=pod =encoding utf-8 =head1 PURPOSE Check C<< unimport >> works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014, 2017 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. =cut use strict; use warnings; use Test::More tests => 7; use lib qw( examples ../examples ); { package Local::Pkg1; use Example::Exporter; ::is( fib(6), 8, 'fib exported' ); no Example::Exporter; } ok( !Local::Pkg1->can('fib'), 'tidied fib' ); { package Local::Pkg2; use Example::Exporter fib => { -as => 'fibo' }; ::is( fibo(6), 8, 'fibo exported' ); no Example::Exporter; } ok( !Local::Pkg2->can('fibo'), 'tidied fibo' ); { package Local::Pkg3; use Example::Exporter -all; ::is( fib(6), 8, 'fib exported' ); ::is( embiggen(6), 7, 'embiggen exported' ); no Example::Exporter qw( /^F/i ); } ok( Local::Pkg3->can('embiggen') && !Local::Pkg3->can('fib'), 'tidied by regexp' ); Exporter.pm000664001750001750 210713110543465 20643 0ustar00taitai000000000000Exporter-Tiny-1.000000/examples/Exampleuse 5.006001; use strict; use warnings; package Example::Exporter; # Inherit from Exporter::Tiny. # use base 'Exporter::Tiny'; # The list of functions to export by default. # Be conservative. # our @EXPORT = qw( fib ); # The list of functions which are allowed to # be exported. Be liberal. # our @EXPORT_OK = qw( embiggen ); # Note that there was no need to list "fib" # in @EXPORT_OK. It was in @EXPORT, so it's # implicitly ok. # This is the definition of the "fib" function # that we want to export. # sub fib { my $n = $_[0]; (int($n) eq $n) && ($n >= 0) or die "Expected natural number as argument; got '$n'"; return $n if $n < 2; fib($n - 1) + fib($n - 2); } # We won't define a standard embiggen function. # Instead we will generate one when requested. # sub _generate_embiggen { my ($class, $name, $arg, $globals) = @_; my $embiggen_amount = exists($arg->{amount}) ? $arg->{amount} : 1; # This is the sub that will be installed into # the caller's namespace. # return sub ($) { my $n = $_[0]; return $n + $embiggen_amount; } } 1; # Make Perl Happy™ Shiny.pm000664001750001750 466513110543465 17305 0ustar00taitai000000000000Exporter-Tiny-1.000000/lib/Exporterpackage Exporter::Shiny; use 5.006001; use strict; use warnings; use Exporter::Tiny (); our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '1.000000'; sub import { my $me = shift; my $caller = caller; (my $nominal_file = $caller) =~ s(::)(/)g; $INC{"$nominal_file\.pm"} ||= __FILE__; if (@_ == 2 and $_[0] eq -setup) { my (undef, $opts) = @_; @_ = @{ delete($opts->{exports}) || [] }; if (%$opts) { Exporter::Tiny::_croak( 'Unsupported Sub::Exporter-style options: %s', join(q[, ], sort keys %$opts), ); } } ref($_) && Exporter::Tiny::_croak('Expected sub name, got ref %s', $_) for @_; no strict qw(refs); push @{"$caller\::ISA"}, 'Exporter::Tiny'; push @{"$caller\::EXPORT_OK"}, @_; } 1; __END__ =pod =encoding utf-8 =head1 NAME Exporter::Shiny - shortcut for Exporter::Tiny =head1 SYNOPSIS use Exporter::Shiny qw( foo bar ); Is a shortcut for: use base "Exporter::Tiny"; push our(@EXPORT_OK), qw( foo bar ); For compatibility with L, the following longer syntax is also supported: use Exporter::Shiny -setup => { exports => [qw( foo bar )], }; =head1 DESCRIPTION This is a very small wrapper to simplify using L. It does the following: =over =item * Marks your package as loaded in C<< %INC >>; =item * Pushes any function names in the import list onto your C<< @EXPORT_OK >>; and =item * Pushes C<< "Exporter::Tiny" >> onto your C<< @ISA >>. =back It doesn't set up C<< %EXPORT_TAGS >> or C<< @EXPORT >>, but there's nothing stopping you doing that yourself. =head1 BUGS Please report any bugs to L. =head1 SEE ALSO This module is just a wrapper around L, so take a look at L and L for further information on what features are available. Other interesting exporters: L, L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014, 2017 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. =head1 DISCLAIMER OF WARRANTIES 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. Tiny.pm000664001750001750 2731113110543465 17147 0ustar00taitai000000000000Exporter-Tiny-1.000000/lib/Exporterpackage Exporter::Tiny; use 5.006001; use strict; use warnings; no warnings qw(void once uninitialized numeric redefine); our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '1.000000'; our @EXPORT_OK = qw< mkopt mkopt_hash _croak _carp >; sub _croak ($;@) { require Carp; my $fmt = shift; @_ = sprintf($fmt, @_); goto \&Carp::croak } sub _carp ($;@) { require Carp; my $fmt = shift; @_ = sprintf($fmt, @_); goto \&Carp::carp } my $_process_optlist = sub { my $class = shift; my ($global_opts, $opts, $want, $not_want) = @_; while (@$opts) { my $opt = shift @{$opts}; my ($name, $value) = @$opt; ($name =~ m{\A\!(/.+/[msixpodual]+)\z}) ? do { my @not = $class->_exporter_expand_regexp($1, $value, $global_opts); ++$not_want->{$_->[0]} for @not; } : ($name =~ m{\A\!(.+)\z}) ? (++$not_want->{$1}) : ($name =~ m{\A[:-](.+)\z}) ? push(@$opts, $class->_exporter_expand_tag($1, $value, $global_opts)) : ($name =~ m{\A/.+/[msixpodual]+\z}) ? push(@$opts, $class->_exporter_expand_regexp($name, $value, $global_opts)) : # else ? push(@$want, $opt); } }; sub import { my $class = shift; my $global_opts = +{ @_ && ref($_[0]) eq q(HASH) ? %{+shift} : () }; $global_opts->{into} = caller unless exists $global_opts->{into}; my @want; my %not_want; $global_opts->{not} = \%not_want; my @args = do { no strict qw(refs); @_ ? @_ : @{"$class\::EXPORT"} }; my $opts = mkopt(\@args); $class->$_process_optlist($global_opts, $opts, \@want, \%not_want); my $permitted = $class->_exporter_permitted_regexp($global_opts); $class->_exporter_validate_opts($global_opts); for my $wanted (@want) { next if $not_want{$wanted->[0]}; my %symbols = $class->_exporter_expand_sub(@$wanted, $global_opts, $permitted); $class->_exporter_install_sub($_, $wanted->[1], $global_opts, $symbols{$_}) for keys %symbols; } } sub unimport { my $class = shift; my $global_opts = +{ @_ && ref($_[0]) eq q(HASH) ? %{+shift} : () }; $global_opts->{into} = caller unless exists $global_opts->{into}; $global_opts->{is_unimport} = 1; my @want; my %not_want; $global_opts->{not} = \%not_want; my @args = do { our %TRACKED; @_ ? @_ : keys(%{$TRACKED{$class}{$global_opts->{into}}}) }; my $opts = mkopt(\@args); $class->$_process_optlist($global_opts, $opts, \@want, \%not_want); my $permitted = $class->_exporter_permitted_regexp($global_opts); $class->_exporter_validate_unimport_opts($global_opts); my $expando = $class->can('_exporter_expand_sub'); $expando = undef if $expando == \&_exporter_expand_sub; for my $wanted (@want) { next if $not_want{$wanted->[0]}; if ($wanted->[1]) { _carp("Passing options to unimport '%s' makes no sense", $wanted->[0]) unless (ref($wanted->[1]) eq 'HASH' and not keys %{$wanted->[1]}); } my %symbols = defined($expando) ? $class->$expando(@$wanted, $global_opts, $permitted) : ($wanted->[0] => sub { "dummy" }); $class->_exporter_uninstall_sub($_, $wanted->[1], $global_opts) for keys %symbols; } } # Called once per import/unimport, passed the "global" import options. # Expected to validate the options and carp or croak if there are problems. # Can also take the opportunity to do other stuff if needed. # sub _exporter_validate_opts { 1 } sub _exporter_validate_unimport_opts { 1 } # Called after expanding a tag or regexp to merge the tag's options with # any sub-specific options. # sub _exporter_merge_opts { my $class = shift; my ($tag_opts, $global_opts, @stuff) = @_; $tag_opts = {} unless ref($tag_opts) eq q(HASH); _croak('Cannot provide an -as option for tags') if exists $tag_opts->{-as} && ref $tag_opts->{-as} ne 'CODE'; my $optlist = mkopt(\@stuff); for my $export (@$optlist) { next if defined($export->[1]) && ref($export->[1]) ne q(HASH); my %sub_opts = ( %{ $export->[1] or {} }, %$tag_opts ); $sub_opts{-prefix} = sprintf('%s%s', $tag_opts->{-prefix}, $export->[1]{-prefix}) if exists($export->[1]{-prefix}) && exists($tag_opts->{-prefix}); $sub_opts{-suffix} = sprintf('%s%s', $export->[1]{-suffix}, $tag_opts->{-suffix}) if exists($export->[1]{-suffix}) && exists($tag_opts->{-suffix}); $export->[1] = \%sub_opts; } return @$optlist; } # Given a tag name, looks it up in %EXPORT_TAGS and returns the list of # associated functions. The default implementation magically handles tags # "all" and "default". The default implementation interprets any undefined # tags as being global options. # sub _exporter_expand_tag { no strict qw(refs); my $class = shift; my ($name, $value, $globals) = @_; my $tags = \%{"$class\::EXPORT_TAGS"}; return $class->_exporter_merge_opts($value, $globals, $tags->{$name}->($class, @_)) if ref($tags->{$name}) eq q(CODE); return $class->_exporter_merge_opts($value, $globals, @{$tags->{$name}}) if exists $tags->{$name}; return $class->_exporter_merge_opts($value, $globals, @{"$class\::EXPORT"}, @{"$class\::EXPORT_OK"}) if $name eq 'all'; return $class->_exporter_merge_opts($value, $globals, @{"$class\::EXPORT"}) if $name eq 'default'; $globals->{$name} = $value || 1; return; } # Given a regexp-like string, looks it up in @EXPORT_OK and returns the # list of matching functions. # sub _exporter_expand_regexp { no strict qw(refs); our %TRACKED; my $class = shift; my ($name, $value, $globals) = @_; my $compiled = eval("qr$name"); my @possible = $globals->{is_unimport} ? keys( %{$TRACKED{$class}{$globals->{into}}} ) : @{"$class\::EXPORT_OK"}; $class->_exporter_merge_opts($value, $globals, grep /$compiled/, @possible); } # Helper for _exporter_expand_sub. Returns a regexp matching all subs in # the exporter package which are available for export. # sub _exporter_permitted_regexp { no strict qw(refs); my $class = shift; my $re = join "|", map quotemeta, sort { length($b) <=> length($a) or $a cmp $b } @{"$class\::EXPORT"}, @{"$class\::EXPORT_OK"}; qr{^(?:$re)$}ms; } # Given a sub name, returns a hash of subs to install (usually just one sub). # Keys are sub names, values are coderefs. # sub _exporter_expand_sub { my $class = shift; my ($name, $value, $globals, $permitted) = @_; $permitted ||= $class->_exporter_permitted_regexp($globals); no strict qw(refs); if ($name =~ $permitted) { my $generator = $class->can("_generate_$name"); return $name => $class->$generator($name, $value, $globals) if $generator; my $sub = $class->can($name); return $name => $sub if $sub; } $class->_exporter_fail(@_); } # Called by _exporter_expand_sub if it is unable to generate a key-value # pair for a sub. # sub _exporter_fail { my $class = shift; my ($name, $value, $globals) = @_; return if $globals->{is_unimport}; _croak("Could not find sub '%s' exported by %s", $name, $class); } # Actually performs the installation of the sub into the target package. This # also handles renaming the sub. # sub _exporter_install_sub { my $class = shift; my ($name, $value, $globals, $sym) = @_; my $into = $globals->{into}; my $installer = $globals->{installer} || $globals->{exporter}; $name = ref $globals->{as} ? $globals->{as}->($name) : ref $value->{-as} ? $value->{-as}->($name) : exists $value->{-as} ? $value->{-as} : $name; return unless defined $name; unless (ref($name)) { my ($prefix) = grep defined, $value->{-prefix}, $globals->{prefix}, q(); my ($suffix) = grep defined, $value->{-suffix}, $globals->{suffix}, q(); $name = "$prefix$name$suffix"; } return ($$name = $sym) if ref($name) eq q(SCALAR); return ($into->{$name} = $sym) if ref($into) eq q(HASH); no strict qw(refs); if (exists &{"$into\::$name"} and \&{"$into\::$name"} != $sym) { my ($level) = grep defined, $value->{-replace}, $globals->{replace}, q(0); my $action = { carp => \&_carp, 0 => \&_carp, '' => \&_carp, warn => \&_carp, nonfatal => \&_carp, croak => \&_croak, fatal => \&_croak, die => \&_croak, }->{$level} || sub {}; $action->( $action == \&_croak ? "Refusing to overwrite existing sub '%s::%s' with sub '%s' exported by %s" : "Overwriting existing sub '%s::%s' with sub '%s' exported by %s", $into, $name, $_[0], $class, ); } our %TRACKED; $TRACKED{$class}{$into}{$name} = $sym; no warnings qw(prototype); $installer ? $installer->($globals, [$name, $sym]) : (*{"$into\::$name"} = $sym); } sub _exporter_uninstall_sub { our %TRACKED; my $class = shift; my ($name, $value, $globals, $sym) = @_; my $into = $globals->{into}; ref $into and return; no strict qw(refs); # Cowardly refuse to uninstall a sub that differs from the one # we installed! my $our_coderef = $TRACKED{$class}{$into}{$name}; my $cur_coderef = exists(&{"$into\::$name"}) ? \&{"$into\::$name"} : -1; return unless $our_coderef == $cur_coderef; my $stash = \%{"$into\::"}; my $old = delete $stash->{$name}; my $full_name = join('::', $into, $name); foreach my $type (qw(SCALAR HASH ARRAY IO)) # everything but the CODE { next unless defined(*{$old}{$type}); *$full_name = *{$old}{$type}; } delete $TRACKED{$class}{$into}{$name}; } sub mkopt { my $in = shift or return []; my @out; $in = [map(($_ => ref($in->{$_}) ? $in->{$_} : ()), sort keys %$in)] if ref($in) eq q(HASH); for (my $i = 0; $i < @$in; $i++) { my $k = $in->[$i]; my $v; ($i == $#$in) ? ($v = undef) : !defined($in->[$i+1]) ? (++$i, ($v = undef)) : !ref($in->[$i+1]) ? ($v = undef) : ($v = $in->[++$i]); push @out, [ $k => $v ]; } \@out; } sub mkopt_hash { my $in = shift or return; my %out = map +($_->[0] => $_->[1]), @{ mkopt($in) }; \%out; } 1; __END__ =pod =encoding utf-8 =for stopwords frobnicate greps regexps =head1 NAME Exporter::Tiny - an exporter with the features of Sub::Exporter but only core dependencies =head1 SYNOPSIS package MyUtils; use base "Exporter::Tiny"; our @EXPORT = qw(frobnicate); sub frobnicate { ... } 1; package MyScript; use MyUtils "frobnicate" => { -as => "frob" }; print frob(42); exit; =head1 DESCRIPTION Exporter::Tiny supports many of Sub::Exporter's external-facing features including renaming imported functions with the C<< -as >>, C<< -prefix >> and C<< -suffix >> options; explicit destinations with the C<< into >> option; and alternative installers with the C<< installer >> option. But it's written in only about 40% as many lines of code and with zero non-core dependencies. Its internal-facing interface is closer to Exporter.pm, with configuration done through the C<< @EXPORT >>, C<< @EXPORT_OK >> and C<< %EXPORT_TAGS >> package variables. If you are trying to B a module that inherits from Exporter::Tiny, then look at: =over =item * L =item * L =back If you are trying to B a module that inherits from Exporter::Tiny, then look at: =over =item * L =back =head1 BUGS Please report any bugs to L. =head1 SUPPORT B<< IRC: >> support is available through in the I<< #moops >> channel on L. =head1 SEE ALSO Simplified interface to this module: L. Other interesting exporters: L, L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017 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. =head1 DISCLAIMER OF WARRANTIES 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. Etc.pod000664001750001750 1102513110543465 21240 0ustar00taitai000000000000Exporter-Tiny-1.000000/lib/Exporter/Tiny/Manual=pod =encoding utf-8 =for stopwords frobnicate greps regexps =head1 NAME Exporter::Tiny::Manual::Etc - odds and ends =head1 DESCRIPTION =head2 Utility Functions Exporter::Tiny is itself an exporter! These functions are really for internal use, but can be exported if you need them: =over =item C<< mkopt(\@array) >> Similar to C from L. It doesn't support all the fancy options that Data::OptList does (C, C, C and C) but runs about 50% faster. =item C<< mkopt_hash(\@array) >> Similar to C from L. See also C. =back =head2 History L had a bunch of custom exporting code which poked coderefs into its caller's stash. It needed this to be something more powerful than most exporters so that it could switch between exporting Moose, Mouse and Moo-compatible objects on request. L would have been capable, but had too many dependencies for the Type::Tiny project. Meanwhile L, L and L each used the venerable L. However, this meant they were unable to use the features like L-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. As of version 0.026, Exporter::TypeTiny was also made available as L, distributed independently on CPAN. CHOCOLATEBOY had convinced me that it was mature enough to live a life of its own. As of version 0.030, Type-Tiny depends on Exporter::Tiny and Exporter::TypeTiny is being phased out. =head2 Obligatory Exporter Comparison Exporting is unlikely to be your application's performance bottleneck, but nonetheless here are some comparisons. B<< Comparative sizes according to L: >> Exporter 217.1Kb Sub::Exporter::Progressive 263.2Kb Exporter::Tiny 267.7Kb Exporter + Exporter::Heavy 281.5Kb Exporter::Renaming 406.2Kb Sub::Exporter 701.0Kb B<< Performance exporting a single sub: >> Rate SubExp ExpTiny SubExpProg ExpPM SubExp 2489/s -- -56% -85% -88% ExpTiny 5635/s 126% -- -67% -72% SubExpProg 16905/s 579% 200% -- -16% ExpPM 20097/s 707% 257% 19% -- (Exporter::Renaming globally changes the behaviour of Exporter.pm, so could not be included in the same benchmarks.) B<< (Non-Core) Dependencies: >> Exporter -1 Exporter::Renaming 0 Exporter::Tiny 0 Sub::Exporter::Progressive 0 Sub::Exporter 3 B<< Features: >> ExpPM ExpTiny SubExp SubExpProg Can export code symbols............. Yes Yes Yes Yes Can export non-code symbols......... Yes Groups/tags......................... Yes Yes Yes Yes Export by regexp.................... Yes Yes Bang prefix......................... Yes Yes Allows renaming of subs............. Yes Yes Maybe Install code into scalar refs....... Yes Yes Maybe Can be passed an "into" parameter... Yes Yes Maybe Can be passed an "installer" sub.... Yes Yes Maybe Config avoids package variables..... Yes Supports generators................. Yes Yes Sane API for generators............. Yes Yes Unimport............................ Yes (Certain Sub::Exporter::Progressive features are only available if Sub::Exporter is installed.) =head1 SEE ALSO L, L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017 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. =head1 DISCLAIMER OF WARRANTIES 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. Exporting.pod000664001750001750 2003013110543465 22500 0ustar00taitai000000000000Exporter-Tiny-1.000000/lib/Exporter/Tiny/Manual=pod =encoding utf-8 =for stopwords frobnicate greps regexps =head1 NAME Exporter::Tiny::Manual::Exporting - creating an exporter using Exporter::Tiny =head1 SYNOPSIS B<< Read L first! >> =head1 DESCRIPTION Simple configuration works the same as L; inherit from L, and use the C<< @EXPORT >>, C<< @EXPORT_OK >>, and C<< %EXPORT_TAGS >> package variables to list subs to export. Unlike Exporter, Exporter::Tiny performs most of its internal duties (including resolution of tag names to sub names, resolution of sub names to coderefs, and installation of coderefs into the target package) as B, which means that your module (which is a subclass of Exporter::Tiny) can override them to provide interesting behaviour. =head2 Advanced Tag Stuff You can define tags using other tags: use Exporter::Shiny qw( black white red green blue cyan magenta yellow ); our %EXPORT_TAGS = ( rgb => [qw( red green blue )], cym => [qw( cyan magenta yellow )], cymk => [qw( black :cym )], monochrome => [qw( black white )], all => [qw( :rgb :cymk :monochrome )], ); B<< CAVEAT: >> If you create a cycle in the tags, this could put Exporter::Tiny into an infinite loop expanding the tags. Don't do that. =head2 More on Generators Exporter::Tiny has always allowed exported subs to be generated (like L), but until version 0.025 did not have an especially nice API for it. Now, it's easy. If you want to generate a sub C to export, list it in C<< @EXPORT >> or C<< @EXPORT_OK >> as usual, and then simply give your exporter module a class method called C<< _generate_foo >>. push @EXPORT_OK, 'foo'; sub _generate_foo { my $class = shift; my ($name, $args, $globals) = @_; return sub { ...; } } We showed how to do that in L, but one thing we didn't show was that C<< $globals >> gets passed in there. This is the global options hash, as described in L. It can often be useful. In particular it will tell you what package the generated sub is destined to be installed into. You can also generate tags: my %constants; BEGIN { %constants = (FOO => 1, BAR => 2); } use constant \%constants; $EXPORT_TAGS{constants} = sub { my $class = shift; my ($name, $args, $globals) = @_; return keys(%constants); }; =head2 Hooks Sometimes as well as exporting stuff, you want to do some setup or something. You can define a couple of class methods in your package, and they'll get called at the appropriate time: package MyUtils; ...; sub _exporter_validate_opts { my $class = shift; my ($globals) = @_; ...; # do stuff here $class->SUPER::_exporter_validate_opts(@_); } sub _exporter_validate_unimport_opts { my $class = shift; my ($globals) = @_; ...; # do stuff here $class->SUPER::_exporter_validate_unimport_opts(@_); } The C<< $globals >> variable is that famous global options hash. In particular, C<< $globals->{into} >> is useful because it tells you what package has imported you. As you might have guessed, these methods were originally intended to validate the global options hash, but can be used to perform any general duties before the real exporting work is done. =head2 Overriding Internals An important difference between L and Exporter::Tiny is that the latter calls all its internal functions as I<< class methods >>. This means that your subclass can I<< override them >> to alter their behaviour. The following methods are available to be overridden. Despite being named with a leading underscore, they are considered public methods. (The underscore is there to avoid accidentally colliding with any of your own function names.) =over =item C<< _exporter_validate_opts($globals) >> Documented above. =item C<< _exporter_validate_unimport_opts($globals) >> Documented above. =item C<< _exporter_merge_opts($tag_opts, $globals, @exports) >> Called to merge options which have been provided for a tag into the options provided for the exports that the tag expanded to. =item C<< _exporter_expand_tag($name, $args, $globals) >> This method is called to expand an import tag (e.g. C<< ":constants" >>). It is passed the tag name (minus the leading ":"), an optional hashref of options (like C<< { -prefix => "foo_" } >>), and the global options hashref. It is expected to return a list of ($name, $args) arrayref pairs. These names can be sub names to export, or further tag names (which must have their ":"). If returning tag names, be careful to avoid creating a tag expansion loop! The default implementation uses C<< %EXPORT_TAGS >> to expand tags, and provides fallbacks for the C<< :default >> and C<< :all >> tags. =item C<< _exporter_expand_regexp($regexp, $args, $globals) >> Like C<_exporter_expand_regexp>, but given a regexp-like string instead of a tag name. The default implementation greps through C<< @EXPORT_OK >> for imports, and the list of already-imported functions for exports. =item C<< _exporter_expand_sub($name, $args, $globals) >> This method is called to translate a sub name to a hash of name => coderef pairs for exporting to the caller. In general, this would just be a hash with one key and one value, but, for example, L overrides this method so that C<< "+Foo" >> gets expanded to: ( Foo => sub { $type }, is_Foo => sub { $type->check(@_) }, to_Foo => sub { $type->assert_coerce(@_) }, assert_Foo => sub { $type->assert_return(@_) }, ) The default implementation checks that the name is allowed to be exported (using the C<_exporter_permitted_regexp> method), gets the coderef using the generator if there is one (or by calling C<< can >> on your exporter otherwise) and calls C<_exporter_fail> if it's unable to generate or retrieve a coderef. =item C<< _exporter_permitted_regexp($globals) >> This method is called to retrieve a regexp for validating the names of exportable subs. If a sub doesn't match the regexp, then the default implementation of C<_exporter_expand_sub> will refuse to export it. (Of course, you may override the default C<_exporter_expand_sub>.) The default implementation of this method assembles the regexp from C<< @EXPORT >> and C<< @EXPORT_OK >>. =item C<< _exporter_fail($name, $args, $globals) >> Called by C<_exporter_expand_sub> if it can't find a coderef to export. The default implementation just throws an exception. But you could emit a warning instead, or just ignore the failed export. If you don't throw an exception then you should be aware that this method is called in list context, and any list it returns will be treated as an C<_exporter_expand_sub>-style hash of names and coderefs for export. =item C<< _exporter_install_sub($name, $args, $globals, $coderef) >> This method actually installs the exported sub into its new destination. Its return value is ignored. The default implementation handles sub renaming (i.e. the C<< -as >>, C<< -prefix >> and C<< -suffix >> functions. This method does a lot of stuff; if you need to override it, it's probably a good idea to just pre-process the arguments and then call the super method rather than trying to handle all of it yourself. =item C<< _exporter_uninstall_sub($name, $args, $globals) >> The opposite of C<_exporter_install_sub>. =back =head1 SEE ALSO L, L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017 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. =head1 DISCLAIMER OF WARRANTIES 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. Importing.pod000664001750001750 1615513110543465 22506 0ustar00taitai000000000000Exporter-Tiny-1.000000/lib/Exporter/Tiny/Manual=pod =encoding utf-8 =for stopwords frobnicate greps regexps =head1 NAME Exporter::Tiny::Manual::Importing - importing from Exporter::Tiny-based modules =head1 DESCRIPTION For the purposes of this discussion we'll assume we have a module called C<< MyUtils >> which exports functions called C, C, C, and C. It has a tag set up called C<:colours> which corresponds to C, C, and C. Many of these tricks may seem familiar from L. That is intentional. Exporter::Tiny doesn't attempt to provide every feature of Sub::Exporter, but where it does it usually uses a fairly similar API. =head2 Basic importing It's easy to import a single function from a module: use MyUtils "frobnicate"; Or a list of functions: use MyUtils "red", "green"; Perl's C<< qw() >> shorthand for a list of words is pretty useful: use MyUtils qw( red green ); If the module defines tags, you can import them like this: use MyUtils qw( :colours ); Or with a hyphen instead of a colon: use MyUtils qw( -colours ); Hyphens are good because Perl will autoquote a bareword that follows them: use MyUtils -colours; And it's possible to mix function names and tags in the same list: use MyUtils qw( frobnicate :colours ); =head2 Renaming imported functions It's possible to rename a function you're importing: use MyUtils "frobnicate" => { -as => "frob" }; Or you can apply a prefix and/or suffix. The following imports the function and calls it C. use MyUtils "frobnicate" => { -prefix => "my_", -suffix => "_thing" }; You can apply a prefix/suffix to B functions you import by placing the hashref B in the import list. (This first hashref is referred to as the global options hash, and can do some special things.) use MyUtils { prefix => "my_" }, "frobnicate"; Did you notice that we used C<< -prefix >> and C<< -suffix >> in the normal options hash, but C<< prefix >> and C<< suffix >> (no hyphen) in the global options hash? That's a common pattern with this module. You can import the same function multiple times with different names: use MyUtils "frobnicate" => { -as => "frob" }, "frobnicate" => { -as => "frbnct" }; Tags can take the C<< -prefix >> and C<< -suffix >> options too. The following imports C, C, and C: use MyUtils -colours => { -prefix => "colour_" }; You can also set C<< -as >> to be a coderef to generate a function name. This imports functions called C, C, and C: use MyUtils -colours => { -as => sub { uc($_[0]) } }; Note that it doesn't make sense to use C<< -as >> with a tag unless you're doing this coderef thing. Coderef C<< as >> also works in the global options hash. =head2 DO NOT WANT! Sometimes you want to supply a list of functions you B<< don't >> want to import. To do that, prefix the function with a bang. This imports everything except "frobnicate": use MyUtils qw( -all !frobnicate ); You can add the bang prefix to tags too. This will import everything except the colours. use MyUtils qw( -all !:colours ); Negated imports always "win", so the following will not import "frobnicate", no matter how many times you repeat it... use MyUtils qw( !frobnicate frobnicate frobnicate frobnicate ); =head2 Importing by regexp Here's how you could import all functions beginning with an "f": use MyUtils qw( /^F/i ); Or import everything except functions beginning with a "z": use MyUtils qw( -all !/^Z/i ); Note that regexps are always supplied as I starting with C<< "/" >>, and not as quoted regexp references (C<< qr/.../ >>). =head2 Import functions into another package Occasionally you need to import functions not into your own package, but into a different package. You can do that like this: use MyUtils { into => "OtherPkg" }, "frobnicate"; OtherPkg::frobincate(...); However, L will probably provide you with a better approach which doesn't just work with Exporter::Tiny, but B exporters. =head2 Lexical subs Often you want to make use of an exported function, but don't want it to "pollute" your namespace. There is this L thing that was designed as a plugin for L, but Exporter::Tiny's API is close enough that it will work. Do you remember that global options hash? Just use that to tell Exporter::Tiny to use an alternative sub installer. { use Sub::Exporter::Lexical lexical_installer => { -as => "lex" }; use MyUtils { installer => lex }, "frobnicate"; frobnicate(...); # ok } frobnicate(...); # not ok Another way to do lexical functions is to import a function into a scalar variable: my $func; use MyUtils "frobnicate" => { -as => \$func }; $func->(...); You can even provide a hashref to put all imported functions into as part of that global options hash I mentioned earlier. my %funcs; use MyUtils { into => \%funcs }, "frobnicate"; $funcs{frobnicate}->(...); =head2 Unimporting You can unimport the functions that MyUtils added to your namespace: no MyUtils; Or just specific ones: no MyUtils qw(frobnicate); If you renamed a function when you imported it, you should unimport by the new name: use MyUtils frobnicate => { -as => "frob" }; ...; no MyUtils "frob"; Unimporting using tags and regexps should mostly do what you want. =head1 DIAGNOSTICS =over =item B<< Overwriting existing sub '%s::%s' with sub '%s' exported by %s >> A warning issued if Exporter::Tiny is asked to export a symbol which will result in an existing sub being overwritten. This warning can be suppressed using either of the following: use MyUtils { replace => 1 }, "frobnicate"; use MyUtils "frobnicate" => { -replace => 1 }; Or can be upgraded to a fatal error: use MyUtils { replace => "die" }, "frobnicate"; use MyUtils "frobnicate" => { -replace => "die" }; =item B<< Refusing to overwrite existing sub '%s::%s' with sub '%s' exported by %s >> The fatal version of the above warning. =item B<< Could not find sub '%s' exported by %s >> You requested to import a sub which the package does not provide. =item B<< Cannot provide an -as option for tags >> Because a tag may provide more than one function, it does not make sense to request a single name for it. Instead use C<< -prefix >> or C<< -suffix >>. =item B<< Passing options to unimport '%s' makes no sense >> When you import a sub, it occasionally makes sense to pass some options for it. However, when unimporting, options do nothing, so this warning is issued. =back =head1 SEE ALSO L, L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017 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. =head1 DISCLAIMER OF WARRANTIES 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. QuickStart.pod000664001750001750 1031213110543465 22615 0ustar00taitai000000000000Exporter-Tiny-1.000000/lib/Exporter/Tiny/Manual=pod =encoding utf-8 =for stopwords frobnicate greps regexps =head1 NAME Exporter::Tiny::Manual::QuickStart - the quickest way to get up and running with Exporter::Tiny =head1 SYNOPSIS package MyUtils; use Exporter::Shiny qw( frobnicate ); sub frobnicate { ...; # your code here } 1; Now people can use your module like this: use MyUtils "frobnicate"; frobnicate(42); Or like this: use MyUtils "frobnicate" => { -as => "frob" }; frob(42); =head1 DESCRIPTION See the synopsis. Yes, it's that simple. =head2 Next steps =head3 Default exports Note that the module in the synopsis doesn't export anything by default. If people load C like this: use MyUtils; Then they haven't imported any functions. You can specify a default set of functions to be exported like this: package MyUtils; use Exporter::Shiny qw( frobnicate ); our @EXPORT = qw( frobnicate ); sub frobnicate { ... } 1; Or, if you want to be a superstar rock god: package MyUtils; use Exporter::Shiny our @EXPORT = qw( frobnicate ); sub frobnicate { ... } 1; =head3 Tags You can provide tags for people to use: package MyUtils; use Exporter::Shiny qw( frobnicate red green blue ); our %EXPORT_TAGS = ( utils => [qw/ frobnicate /], colours => [qw/ red green blue /], ); sub frobnicate { ... } sub red { ... } sub green { ... } sub blue { ... } 1; And people can now import your functions like this: use MyUtils ":colours"; Or this: use MyUtils "-colours"; Or take advantage of the fact that Perl magically quotes barewords preceded by a hyphen: use MyUtils -colours; Two tags are automatically defined for you: C<< -default >> (which is just the same as C<< @EXPORT >>) and C<< -all >> (which is the union of C<< @EXPORT >> and C<< @EXPORT_OK >>). If you don't like them, then you can override them: our %EXPORT_TAGS = ( default => \@some_other_stuff, all => \@more_stuff, ); =head3 Generators Exporting normally just works by copying a sub from your package into your caller's package. But sometimes it's useful instead to generate a I sub to insert into your caller's package. This is pretty easy to do. package MyUtils; use Exporter::Shiny qw( frobnicate ); sub _generate_frobnicate { my $me = shift; my $caller = caller; my ($name, $args) = @_; return sub { ...; # your code here }; } 1; The parameter C<< $me >> here is a string containing the package name which is being imported from; C<< $caller >> is the destination package; C<< $name >> is the name of the sub (in this case "frobnicate"); and C<< $args >> is a hashref of custom arguments for this function. # The hashref { foo => 42 } is $args above. # use MyUtils "frobnicate" => { foo => 42 }; =head2 Avoiding Exporter::Shiny Exporter::Shiny is a tiny shim around Exporter::Tiny. It should mostly do what you want, but you may sometimes prefer to use Exporter::Tiny directly. The example in the synopsis could have been written as: package MyUtils; use parent "Exporter::Tiny"; our @EXPORT_OK = qw( frobnicate ); sub frobnicate { ...; # your code here } 1; What Exporter::Shiny does is mostly just to set C<< @EXPORT_OK >> for you and set up inheritance from the base class (Exporter::Tiny). Exporter::Shiny also sets C<< $INC{'MyUtils.pm} >> for you, which in usually makes little difference, but is useful in some edge cases. =head1 SEE ALSO L, L. For more advanced information, see L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017 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. =head1 DISCLAIMER OF WARRANTIES 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.