Hello community,
here is the log from the commit of package perl-Exporter-Tiny for
openSUSE:Factory checked in at 2015-04-15 16:24:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Exporter-Tiny (Old)
and /work/SRC/openSUSE:Factory/.perl-Exporter-Tiny.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Exporter-Tiny"
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Exporter-Tiny/perl-Exporter-Tiny.changes
2014-09-22 18:50:34.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Exporter-Tiny.new/perl-Exporter-Tiny.changes
2015-04-15 16:24:11.000000000 +0200
@@ -1,0 +2,24 @@
+Mon Apr 13 19:24:34 UTC 2015 - [email protected]
+
+- updated to 0.042
+ see /usr/share/doc/packages/perl-Exporter-Tiny/Changes
+
+ 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.
+
+-------------------------------------------------------------------
Old:
----
Exporter-Tiny-0.040.tar.gz
New:
----
Exporter-Tiny-0.042.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Exporter-Tiny.spec ++++++
--- /var/tmp/diff_new_pack.ioNjMX/_old 2015-04-15 16:24:11.000000000 +0200
+++ /var/tmp/diff_new_pack.ioNjMX/_new 2015-04-15 16:24:11.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Exporter-Tiny
#
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: perl-Exporter-Tiny
-Version: 0.040
+Version: 0.042
Release: 0
%define cpan_name Exporter-Tiny
Summary: an exporter with the features of Sub::Exporter but only core
dependencies
++++++ Exporter-Tiny-0.040.tar.gz -> Exporter-Tiny-0.042.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/COPYRIGHT
new/Exporter-Tiny-0.042/COPYRIGHT
--- old/Exporter-Tiny-0.040/COPYRIGHT 2014-09-17 14:01:35.000000000 +0200
+++ new/Exporter-Tiny-0.042/COPYRIGHT 2014-10-04 19:35:56.000000000 +0200
@@ -9,14 +9,15 @@
t/07regexp.t
t/08tags.t
t/09warnings.t
+ t/10no.t
Copyright: This software is copyright (c) 2014 by Toby Inkster.
License: GPL-1.0+ or Artistic-1.0
-Files: t/01basic.t
- t/02renaming.t
- t/03generators.t
- t/04into.t
-Copyright: This software is copyright (c) 2013 by Toby Inkster.
+Files: Changes
+ META.json
+ META.yml
+ doap.ttl
+Copyright: Copyright 2014 Toby Inkster.
License: GPL-1.0+ or Artistic-1.0
Files: CONTRIBUTING
@@ -26,11 +27,11 @@
Copyright: Unknown
License: Unknown
-Files: Changes
- META.json
- META.yml
- doap.ttl
-Copyright: Copyright 2014 Toby Inkster.
+Files: t/01basic.t
+ t/02renaming.t
+ t/03generators.t
+ t/04into.t
+Copyright: This software is copyright (c) 2013 by Toby Inkster.
License: GPL-1.0+ or Artistic-1.0
Files: COPYRIGHT
@@ -39,16 +40,16 @@
Copyright: None
License: public-domain
-Files: Makefile.PL
- dist.ini
-Copyright: Copyright 2013 Toby Inkster.
-License: GPL-1.0+ or Artistic-1.0
-
Files: README
lib/Exporter/Tiny.pm
Copyright: This software is copyright (c) 2013-2014 by Toby Inkster.
License: GPL-1.0+ or Artistic-1.0
+Files: Makefile.PL
+ dist.ini
+Copyright: Copyright 2013 Toby Inkster.
+License: GPL-1.0+ or Artistic-1.0
+
License: Artistic-1.0
This software is Copyright (c) 2014 by the copyright holder(s).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/Changes
new/Exporter-Tiny-0.042/Changes
--- old/Exporter-Tiny-0.040/Changes 2014-09-17 14:01:31.000000000 +0200
+++ new/Exporter-Tiny-0.042/Changes 2014-10-04 19:35:51.000000000 +0200
@@ -6,6 +6,24 @@
Bug tracker: <http://rt.cpan.org/Dist/Display.html?Queue=Exporter-Tiny>
Maintainer: Toby Inkster (TOBYINK) <[email protected]>
+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 ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/MANIFEST
new/Exporter-Tiny-0.042/MANIFEST
--- old/Exporter-Tiny-0.040/MANIFEST 2014-09-17 14:01:35.000000000 +0200
+++ new/Exporter-Tiny-0.042/MANIFEST 2014-10-04 19:35:56.000000000 +0200
@@ -24,3 +24,4 @@
t/07regexp.t
t/08tags.t
t/09warnings.t
+t/10no.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/META.json
new/Exporter-Tiny-0.042/META.json
--- old/Exporter-Tiny-0.040/META.json 2014-09-17 14:01:35.000000000 +0200
+++ new/Exporter-Tiny-0.042/META.json 2014-10-04 19:35:56.000000000 +0200
@@ -48,11 +48,11 @@
"provides" : {
"Exporter::Shiny" : {
"file" : "lib/Exporter/Shiny.pm",
- "version" : "0.040"
+ "version" : "0.042"
},
"Exporter::Tiny" : {
"file" : "lib/Exporter/Tiny.pm",
- "version" : "0.040"
+ "version" : "0.042"
}
},
"release_status" : "stable",
@@ -72,5 +72,5 @@
"x_IRC" : "irc://irc.perl.org/#moops",
"x_identifier" :
"http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/project"
},
- "version" : "0.040"
+ "version" : "0.042"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/META.yml
new/Exporter-Tiny-0.042/META.yml
--- old/Exporter-Tiny-0.040/META.yml 2014-09-17 14:01:35.000000000 +0200
+++ new/Exporter-Tiny-0.042/META.yml 2014-10-04 19:35:56.000000000 +0200
@@ -25,10 +25,10 @@
provides:
Exporter::Shiny:
file: lib/Exporter/Shiny.pm
- version: '0.040'
+ version: '0.042'
Exporter::Tiny:
file: lib/Exporter/Tiny.pm
- version: '0.040'
+ version: '0.042'
requires:
perl: '5.006001'
resources:
@@ -38,4 +38,4 @@
homepage: https://metacpan.org/release/Exporter-Tiny
license: http://dev.perl.org/licenses/
repository: git://github.com/tobyink/p5-exporter-tiny.git
-version: '0.040'
+version: '0.042'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/Makefile.PL
new/Exporter-Tiny-0.042/Makefile.PL
--- old/Exporter-Tiny-0.040/Makefile.PL 2014-09-17 14:01:35.000000000 +0200
+++ new/Exporter-Tiny-0.042/Makefile.PL 2014-10-04 19:35:56.000000000 +0200
@@ -25,8 +25,8 @@
},
},
"provides" => {
- "Exporter::Shiny" => { file =>
"lib/Exporter/Shiny.pm", version => "0.040" },
- "Exporter::Tiny" => { file => "lib/Exporter/Tiny.pm",
version => "0.040" },
+ "Exporter::Shiny" => { file =>
"lib/Exporter/Shiny.pm", version => 0.042 },
+ "Exporter::Tiny" => { file => "lib/Exporter/Tiny.pm",
version => 0.042 },
},
"release_status" => "stable",
"resources" => {
@@ -43,7 +43,7 @@
x_identifier =>
"http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/project",
x_IRC => "irc://irc.perl.org/#moops",
},
- "version" => "0.040",
+ "version" => 0.042,
};
my %dynamic_config;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/README
new/Exporter-Tiny-0.042/README
--- old/Exporter-Tiny-0.040/README 2014-09-17 14:01:29.000000000 +0200
+++ new/Exporter-Tiny-0.042/README 2014-10-04 19:35:50.000000000 +0200
@@ -128,6 +128,24 @@
Note that regexps are always supplied as *strings* starting with "/", and
not as quoted regexp references (`qr/.../`).
+ 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.
+
TIPS AND TRICKS EXPORTING USING EXPORTER::TINY
Simple configuration works the same as Exporter; inherit from this module,
and use the @EXPORT, @EXPORT_OK and %EXPORT_TAGS package variables to list
@@ -189,6 +207,9 @@
The default implementation does nothing interesting.
+ `_exporter_validate_unimport_opts($globals)`
+ Like `_exporter_validate_opts`, but called for `unimport`.
+
`_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.
@@ -211,7 +232,8 @@
Like `_exporter_expand_regexp`, but given a regexp-like string instead
of a tag name.
- The default implementation greps through @EXPORT_OK.
+ The default implementation greps through @EXPORT_OK for imports, and
+ the list of already-imported functions for exports.
`_exporter_expand_sub($name, $args, $globals)`
This method is called to translate a sub name to a hash of name =>
@@ -262,6 +284,9 @@
the arguments and then call the super method rather than trying to
handle all of it yourself.
+ `_exporter_uninstall_sub($name, $args, $globals)`
+ The opposite of `_exporter_install_sub`.
+
DIAGNOSTICS
Overwriting existing sub '%s::%s' with sub '%s' exported by %s
A warning issued if Exporter::Tiny is asked to export a symbol which
@@ -287,6 +312,11 @@
sense to request a single name for it. Instead use `-prefix` or
`-suffix`.
+ 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.
+
HISTORY
Type::Library had a bunch of custom exporting code which poked coderefs
into its caller's stash. It needed this to be something more powerful than
@@ -350,13 +380,16 @@
Can export code symbols............. Yes Yes Yes Yes
Can export non-code symbols......... Yes
Groups/tags......................... Yes Yes Yes Yes
- Config avoids package variables..... 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
+ Sane API for generators............. Yes Yes
+ Unimport............................ Yes
(Certain Sub::Exporter::Progressive features are only available if
Sub::Exporter is installed.)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/SIGNATURE
new/Exporter-Tiny-0.042/SIGNATURE
--- old/Exporter-Tiny-0.040/SIGNATURE 2014-09-17 14:01:36.000000000 +0200
+++ new/Exporter-Tiny-0.042/SIGNATURE 2014-10-04 19:35:57.000000000 +0200
@@ -15,21 +15,21 @@
Hash: SHA1
SHA1 33317486c4fa2cf7fec85bf92ed38ac0f64233a0 CONTRIBUTING
-SHA1 b187e78e0face05e1a392d13a648de500a5deb65 COPYRIGHT
+SHA1 5980cc638348a4f7438480d881a82ae5e17a1630 COPYRIGHT
SHA1 e3b0c464bb56d4285fa64e31a70b301692dd825c CREDITS
-SHA1 a6666095a9c7e8fdec44dbf5a6c525f5eade430e Changes
+SHA1 5c7b2ac127f2c84b4bac86a882a671fe17a933e3 Changes
SHA1 3b20e9835f489bbf71b1deb6aa7c10729482aa77 INSTALL
SHA1 34f5e12514b91055de4b164a1f2327ef5c30ba53 LICENSE
-SHA1 c6cffae3919435853c4b0771a7a7ce654ad40e2a MANIFEST
-SHA1 908f8524e0abe02fdc2dc71c953fe29f02d751f3 META.json
-SHA1 6195b97257b0b2470611b78e6568de69468efa2b META.yml
-SHA1 d91835e3b66727acf2cab0b40875c4b2ba03e14d Makefile.PL
-SHA1 8ae781915a8d7169cc204f57046927d827717b40 README
+SHA1 7d98e1b385b7b5d70cb9a1497eea3b233f4baa8a MANIFEST
+SHA1 525d4669e3507fc769ab765d6438218af3e9adbb META.json
+SHA1 e50e4613cc1d1abd87c290d1f2953eedad430de2 META.yml
+SHA1 1c9cf0c5db5b9abf7a137c2db5eebd93baafce48 Makefile.PL
+SHA1 29f2538f2e202b70d54cf08d0d7499fa7ddf4c5d README
SHA1 a43593d3e3a79c5f455977ba75083d9f191f6af6 dist.ini
-SHA1 b49a6689975765464a9251f49a1f61199e97cddb doap.ttl
+SHA1 066ce57aee9422a1789f0b42a968b3bb16a4c117 doap.ttl
SHA1 3f65666b300ab7e7a1e5e25fb69e4ce6675e0f63 examples/Example/Exporter.pm
-SHA1 2995e587eeec7913f64661e92062395bad181898 lib/Exporter/Shiny.pm
-SHA1 27663ea8481057c4486d33660954ee91aeb3a6af lib/Exporter/Tiny.pm
+SHA1 90df17b2a1b5cf0ddf5e81d7f8c6fcdf6152f800 lib/Exporter/Shiny.pm
+SHA1 57ff9abef5131446f439a23224522805307fc743 lib/Exporter/Tiny.pm
SHA1 6ba2757140a1c118ae5bac4c10ea8a6275ee15f2 t/01basic.t
SHA1 8b9c883098fbdaf8999c6f8f909a79297870af86 t/02renaming.t
SHA1 103845d83b41f8d3c503d50e9d6012790b25f77f t/03generators.t
@@ -39,10 +39,11 @@
SHA1 803a876d8e5e5b5af567f7a3a6e7a1071a4a48ed t/07regexp.t
SHA1 dbce3f55c87fefdfe5abba21afa5a9c9a9a08cf0 t/08tags.t
SHA1 9cc0bdbc9fd24f98161b4d314bc7c841f2fa8efc t/09warnings.t
+SHA1 2b5c5da82a5c8f2d69d46915b9921d2ceb6ca214 t/10no.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
-iEYEARECAAYFAlQZeCAACgkQzr+BKGoqfTnFeQCfT5392Hg5ncS+72tDuxx6U4sq
-bNcAnjOXWD3d0wxfkj4/F5MGjI8+t76W
-=uPLN
+iEYEARECAAYFAlQwL/wACgkQzr+BKGoqfTkonACeP1ZH9sdg3mJTHQpxoxdgTNQP
+I8YAnjYQAQLXP2fg8wYUZKcbDS5aFJml
+=JZvp
-----END PGP SIGNATURE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/doap.ttl
new/Exporter-Tiny-0.042/doap.ttl
--- old/Exporter-Tiny-0.040/doap.ttl 2014-09-17 14:01:35.000000000 +0200
+++ new/Exporter-Tiny-0.042/doap.ttl 2014-10-04 19:35:55.000000000 +0200
@@ -26,7 +26,7 @@
doap:maintainer <http://purl.org/NET/cpan-uri/person/tobyink>;
doap:name "Exporter-Tiny";
doap:programming-language "Perl";
- doap:release
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-026>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-029_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-030>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-031_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-032>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-033_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-034>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-035_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-035_02>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-036>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-037_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-037_02>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-037_03>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-038>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-039_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-040>;
+ doap:release
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-026>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-029_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-030>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-031_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-032>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-033_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-034>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-035_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-035_02>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-036>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-037_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-037_02>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-037_03>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-038>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-039_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-040>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-041_01>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-041_02>,
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-042>;
doap:repository [
a doap:GitRepository;
doap:browse <https://github.com/tobyink/p5-exporter-tiny>;
@@ -270,6 +270,54 @@
doap:file-release
<http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Exporter-Tiny-0.040.tar.gz>;
doap:revision "0.040"^^xsd:string.
+<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-041_01>
+ 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
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-040>;
+ ];
+ doap-changeset:released-by
<http://purl.org/NET/cpan-uri/person/tobyink>;
+ doap:file-release
<http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Exporter-Tiny-0.041_01.tar.gz>;
+ doap:revision "0.041_01"^^xsd:string.
+
+<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-041_02>
+ 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
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-041_01>;
+ ];
+ doap-changeset:released-by
<http://purl.org/NET/cpan-uri/person/tobyink>;
+ doap:file-release
<http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Exporter-Tiny-0.041_02.tar.gz>;
+ doap:revision "0.041_02"^^xsd:string.
+
+<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-042>
+ 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
<http://purl.org/NET/cpan-uri/dist/Exporter-Tiny/v_0-041_02>;
+ ];
+ doap-changeset:released-by
<http://purl.org/NET/cpan-uri/person/tobyink>;
+ doap:file-release
<http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Exporter-Tiny-0.042.tar.gz>;
+ doap:revision "0.042"^^xsd:string.
+
<http://purl.org/NET/cpan-uri/dist/Type-Tiny/project>
a doap:Project;
dc:contributor <http://purl.org/NET/cpan-uri/person/tobyink>;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/lib/Exporter/Shiny.pm
new/Exporter-Tiny-0.042/lib/Exporter/Shiny.pm
--- old/Exporter-Tiny-0.040/lib/Exporter/Shiny.pm 2014-09-17
14:01:29.000000000 +0200
+++ new/Exporter-Tiny-0.042/lib/Exporter/Shiny.pm 2014-10-04
19:35:50.000000000 +0200
@@ -7,7 +7,7 @@
use Exporter::Tiny ();
our $AUTHORITY = 'cpan:TOBYINK';
-our $VERSION = '0.040';
+our $VERSION = '0.042';
sub import {
my $me = shift;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/lib/Exporter/Tiny.pm
new/Exporter-Tiny-0.042/lib/Exporter/Tiny.pm
--- old/Exporter-Tiny-0.040/lib/Exporter/Tiny.pm 2014-09-17
14:01:29.000000000 +0200
+++ new/Exporter-Tiny-0.042/lib/Exporter/Tiny.pm 2014-10-04
19:35:50.000000000 +0200
@@ -5,23 +5,16 @@
use warnings; no warnings qw(void once uninitialized numeric redefine);
our $AUTHORITY = 'cpan:TOBYINK';
-our $VERSION = '0.040';
+our $VERSION = '0.042';
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 }
-sub import
+my $_process_optlist = sub
{
- my $class = shift;
- my $global_opts = +{ @_ && ref($_[0]) eq q(HASH) ? %{+shift} : () };
- my @args = do { no strict qw(refs); @_ ? @_ :
@{"$class\::EXPORT"} };
- my $opts = mkopt(\@args);
-
- my @want;
- my %not_want;
- $global_opts->{into} = caller unless exists $global_opts->{into};
- $global_opts->{not} = \%not_want;
+ my $class = shift;
+ my ($global_opts, $opts, $want, $not_want) = @_;
while (@$opts)
{
@@ -31,20 +24,33 @@
($name =~ m{\A\!(/.+/[msixpodual]+)\z}) ?
do {
my @not = $class->_exporter_expand_regexp($1,
$value, $global_opts);
- ++$not_want{$_->[0]} for @not;
+ ++$not_want->{$_->[0]} for @not;
} :
($name =~ m{\A\!(.+)\z}) ?
- (++$not_want{$1}) :
+ (++$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);
+ 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);
- $class->_exporter_validate_opts($global_opts);
my $permitted = $class->_exporter_permitted_regexp($global_opts);
+ $class->_exporter_validate_opts($global_opts);
for my $wanted (@want)
{
@@ -56,17 +62,53 @@
}
}
-# Called once per import, passed the "global" import options. Expected to
-# validate the import options and carp or croak if there are problems. Can
-# also take the opportunity to do other stuff if needed.
-#
-sub _exporter_validate_opts
+sub unimport
{
- 1;
+ 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;
@@ -126,12 +168,17 @@
sub _exporter_expand_regexp
{
no strict qw(refs);
+ our %TRACKED;
my $class = shift;
my ($name, $value, $globals) = @_;
my $compiled = eval("qr$name");
- $class->_exporter_merge_opts($value, $globals, grep /$compiled/,
@{"$class\::EXPORT_OK"});
+ 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
@@ -177,6 +224,7 @@
{
my $class = shift;
my ($name, $value, $globals) = @_;
+ return if $globals->{is_unimport};
_croak("Could not find sub '%s' exported by %s", $name, $class);
}
@@ -199,7 +247,6 @@
$name = "$prefix$name$suffix";
}
- return $installer->($globals, [$name, $sym]) if $installer;
return ($$name = $sym) if ref($name) eq q(SCALAR);
return ($into->{$name} = $sym) if ref($into) eq q(HASH);
@@ -230,8 +277,41 @@
);
}
+ our %TRACKED;
+ $TRACKED{$class}{$into}{$name} = $sym;
+
no warnings qw(prototype);
- *{"$into\::$name"} = $sym;
+ $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
@@ -424,6 +504,25 @@
Note that regexps are always supplied as I<strings> starting with
C<< "/" >>, and not as quoted regexp references (C<< qr/.../ >>).
+=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 TIPS AND TRICKS EXPORTING USING EXPORTER::TINY
Simple configuration works the same as L<Exporter>; inherit from this module,
@@ -490,6 +589,10 @@
The default implementation does nothing interesting.
+=item C<< _exporter_validate_unimport_opts($globals) >>
+
+Like C<_exporter_validate_opts>, but called for C<unimport>.
+
=item C<< _exporter_merge_opts($tag_opts, $globals, @exports) >>
Called to merge options which have been provided for a tag into the
@@ -515,7 +618,8 @@
Like C<_exporter_expand_regexp>, but given a regexp-like string instead
of a tag name.
-The default implementation greps through C<< @EXPORT_OK >>.
+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) >>
@@ -570,6 +674,10 @@
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 DIAGNOSTICS
@@ -603,6 +711,12 @@
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 HISTORY
@@ -670,13 +784,16 @@
Can export code symbols............. Yes Yes Yes Yes
Can export non-code symbols......... Yes
Groups/tags......................... Yes Yes Yes Yes
- Config avoids package variables..... 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.)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Exporter-Tiny-0.040/t/10no.t
new/Exporter-Tiny-0.042/t/10no.t
--- old/Exporter-Tiny-0.040/t/10no.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Exporter-Tiny-0.042/t/10no.t 2014-10-04 19:35:50.000000000 +0200
@@ -0,0 +1,54 @@
+=pod
+
+=encoding utf-8
+
+=head1 PURPOSE
+
+Check C<< unimport >> works.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>[email protected]<gt>.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2014 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' );