Hello community, here is the log from the commit of package perl-Sub-Quote for openSUSE:Factory checked in at 2019-03-19 11:06:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Sub-Quote (Old) and /work/SRC/openSUSE:Factory/.perl-Sub-Quote.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Sub-Quote" Tue Mar 19 11:06:59 2019 rev:5 rq:684906 version:2.006003 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Sub-Quote/perl-Sub-Quote.changes 2018-04-25 09:58:31.861051537 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Sub-Quote.new.28833/perl-Sub-Quote.changes 2019-03-19 11:07:06.186105776 +0100 @@ -1,0 +2,25 @@ +Wed Mar 13 16:39:22 UTC 2019 - Stephan Kulow <[email protected]> + +- updated to 2.006003 + see /usr/share/doc/packages/perl-Sub-Quote/Changes + + 2.006003 - 2019-03-10 + - releasing as stable + + 2.006_002 - 2019-01-29 + - Fix quotifying of backslashes in utf8-flagged strings on perl 5.10.0. + + 2.006_001 - 2019-01-07 + - avoid warnings or failures on new perls when testing quoting UTF-8 strings + - test quotify output under utf8 pragma + - fix quoting of negative NaN + + 2.006_000 - 2018-12-29 + - don't test threads behavior on perl < 5.8.5, since they are too unstable + - more tests + - preserve inf, nan, and false in quotify + - improve accuracy of quotified floating point numbers + - SUB_QUOTE_DEBUG can now be set to sub names, package names, or a regex to + match against the code to filter which generated subs are printed to STDERR. + +------------------------------------------------------------------- Old: ---- Sub-Quote-2.005001.tar.gz New: ---- Sub-Quote-2.006003.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Sub-Quote.spec ++++++ --- /var/tmp/diff_new_pack.YlXtUU/_old 2019-03-19 11:07:07.458105838 +0100 +++ /var/tmp/diff_new_pack.YlXtUU/_new 2019-03-19 11:07:07.462105839 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-Sub-Quote # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 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 @@ -12,18 +12,18 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: perl-Sub-Quote -Version: 2.005001 +Version: 2.006003 Release: 0 %define cpan_name Sub-Quote Summary: Efficient generation of subroutines via string eval License: Artistic-1.0 OR GPL-1.0-or-later Group: Development/Libraries/Perl -Url: http://search.cpan.org/dist/Sub-Quote/ +Url: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/H/HA/HAARG/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch @@ -42,11 +42,11 @@ %setup -q -n %{cpan_name}-%{version} %build -%{__perl} Makefile.PL INSTALLDIRS=vendor -%{__make} %{?_smp_mflags} +perl Makefile.PL INSTALLDIRS=vendor +make %{?_smp_mflags} %check -%{__make} test +make test %install %perl_make_install @@ -56,5 +56,6 @@ %files -f %{name}.files %defattr(-,root,root,755) %doc Changes README +%license LICENSE %changelog ++++++ Sub-Quote-2.005001.tar.gz -> Sub-Quote-2.006003.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/Changes new/Sub-Quote-2.006003/Changes --- old/Sub-Quote-2.005001/Changes 2018-04-20 12:52:15.000000000 +0200 +++ new/Sub-Quote-2.006003/Changes 2019-03-10 23:31:42.000000000 +0100 @@ -1,5 +1,24 @@ Revision history for Sub::Quote +2.006003 - 2019-03-10 + - releasing as stable + +2.006_002 - 2019-01-29 + - Fix quotifying of backslashes in utf8-flagged strings on perl 5.10.0. + +2.006_001 - 2019-01-07 + - avoid warnings or failures on new perls when testing quoting UTF-8 strings + - test quotify output under utf8 pragma + - fix quoting of negative NaN + +2.006_000 - 2018-12-29 + - don't test threads behavior on perl < 5.8.5, since they are too unstable + - more tests + - preserve inf, nan, and false in quotify + - improve accuracy of quotified floating point numbers + - SUB_QUOTE_DEBUG can now be set to sub names, package names, or a regex to + match against the code to filter which generated subs are printed to STDERR. + 2.005001 - 2018-04-20 - add a workaround for test failures on early 5.8 releases with threads diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/LICENSE new/Sub-Quote-2.006003/LICENSE --- old/Sub-Quote-2.005001/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/Sub-Quote-2.006003/LICENSE 2019-03-10 23:31:57.000000000 +0100 @@ -0,0 +1,374 @@ +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) 2019 by mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>. + +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. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + 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. + + <signature of Ty Coon>, 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) 2019 by mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>. + +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 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/MANIFEST new/Sub-Quote-2.006003/MANIFEST --- old/Sub-Quote-2.005001/MANIFEST 2018-04-20 12:52:28.000000000 +0200 +++ new/Sub-Quote-2.006003/MANIFEST 2019-03-10 23:31:57.000000000 +0100 @@ -11,13 +11,19 @@ t/lib/ErrorLocation.pm t/lib/InlineModule.pm t/lib/ThreadsCheck.pm +t/quotify-5.6.t t/quotify.t t/sub-defer-no-subname.t t/sub-defer-threads.t t/sub-defer.t t/sub-quote-threads.t t/sub-quote.t +t/subname-none.t +t/subname-sub-name-preload.t +t/subname-sub-name.t +t/subname-sub-util.t xt/release/kwalitee.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) README README file (added by Distar) +LICENSE LICENSE file (added by Distar) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/META.json new/Sub-Quote-2.006003/META.json --- old/Sub-Quote-2.005001/META.json 2018-04-20 12:52:28.000000000 +0200 +++ new/Sub-Quote-2.006003/META.json 2019-03-10 23:31:57.000000000 +0100 @@ -4,7 +4,7 @@ "mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.3, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -63,7 +63,7 @@ }, "x_IRC" : "irc://irc.perl.org/#moose" }, - "version" : "2.005001", + "version" : "2.006003", "x_authority" : "cpan:MSTROUT", - "x_serialization_backend" : "JSON::PP version 2.97001" + "x_serialization_backend" : "JSON::PP version 4.02" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/META.yml new/Sub-Quote-2.006003/META.yml --- old/Sub-Quote-2.005001/META.yml 2018-04-20 12:52:27.000000000 +0200 +++ new/Sub-Quote-2.006003/META.yml 2019-03-10 23:31:56.000000000 +0100 @@ -8,7 +8,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.3, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -28,6 +28,6 @@ bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Sub-Quote license: http://dev.perl.org/licenses/ repository: https://github.com/moose/Sub-Quote.git -version: '2.005001' +version: '2.006003' x_authority: cpan:MSTROUT x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/README new/Sub-Quote-2.006003/README --- old/Sub-Quote-2.005001/README 2018-04-20 12:52:28.000000000 +0200 +++ new/Sub-Quote-2.006003/README 2019-03-10 23:31:57.000000000 +0100 @@ -169,6 +169,27 @@ Sanitizes a value so that it can be used in an identifier. +ENVIRONMENT + SUB_QUOTE_DEBUG + Causes code to be output to "STDERR" before being evaled. Several forms + are supported: + + 1 All subs will be output. + + "/foo/" + Subs will be output if their code matches the given regular + expression. + + "simple_identifier" + Any sub with the given name will be output. + + "Full::identifier" + A sub matching the full name will be output. + + "Package::Name::" + Any sub in the given package (including anonymous subs) will be + output. + CAVEATS Much of this is just string-based code-generation, and as a result, a few caveats apply. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/lib/Sub/Defer.pm new/Sub-Quote-2.006003/lib/Sub/Defer.pm --- old/Sub-Quote-2.005001/lib/Sub/Defer.pm 2018-04-20 12:52:07.000000000 +0200 +++ new/Sub-Quote-2.006003/lib/Sub/Defer.pm 2019-03-10 23:30:43.000000000 +0100 @@ -5,14 +5,12 @@ use Scalar::Util qw(weaken); use Carp qw(croak); -our $VERSION = '2.005001'; +our $VERSION = '2.006003'; $VERSION = eval $VERSION; our @EXPORT = qw(defer_sub undefer_sub undefer_all); our @EXPORT_OK = qw(undefer_package defer_info); -our %DEFERRED; - sub _getglob { no strict 'refs'; \*{$_[0]} } BEGIN { @@ -45,6 +43,31 @@ } } +# We are dealing with three subs. The first is the generator sub. It is +# provided by the user, so we cannot modify it. When called, it generates the +# undeferred sub. This is also created, so it also cannot be modified. These +# are wrapped in a third sub. The deferred sub is generated by us, and when +# called it uses the generator sub to create the undeferred sub. If it is a +# named sub, it is installed in the symbol table, usually overwriting the +# deferred sub. From then on, the deferred sub will goto the undeferred sub +# if it is called. +# +# In %DEFERRED we store array refs with information about these subs. The key +# is the stringified subref. We have a CLONE method to fix this up in the +# case of threading to deal with changing refaddrs. The arrayrefs contain: +# +# 0. fully qualified sub name (or undef) +# 1. generator sub +# 2. options (attributes) +# 3. scalar ref to undeferred sub (inner reference weakened) +# 4. deferred sub (deferred only) +# 5. info arrayref for undeferred sub (deferred only, after undefer) +# +# The deferred sub contains a strong reference to its info arrayref, and the +# undeferred. + +our %DEFERRED; + sub undefer_sub { my ($deferred) = @_; my $info = $DEFERRED{$deferred} or return $deferred; @@ -69,7 +92,7 @@ # _install_coderef calls are not necessary --ribasushi *{_getglob($target)} = $made; } - my $undefer_info = [ $target, $maker, $options, \$$undeferred_ref ]; + my $undefer_info = [ $target, $maker, $options, $undeferred_ref ]; $info->[5] = $DEFERRED{$made} = $undefer_info; weaken ${$undefer_info->[3]}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/lib/Sub/Quote.pm new/Sub-Quote-2.006003/lib/Sub/Quote.pm --- old/Sub-Quote-2.005001/lib/Sub/Quote.pm 2018-04-20 12:52:07.000000000 +0200 +++ new/Sub-Quote-2.006003/lib/Sub/Quote.pm 2019-03-10 23:30:43.000000000 +0100 @@ -14,9 +14,10 @@ BEGIN { *_HAVE_IS_UTF8 = defined &utf8::is_utf8 ? sub(){1} : sub(){0}; *_HAVE_PERLSTRING = defined &B::perlstring ? sub(){1} : sub(){0}; + *_BAD_BACKSLASH_ESCAPE = _HAVE_PERLSTRING() && "$]" == 5.010_000 ? sub(){1} : sub(){0}; } -our $VERSION = '2.005001'; +our $VERSION = '2.006003'; $VERSION = eval $VERSION; our @EXPORT = qw(quote_sub unquote_sub quoted_from_sub qsub); @@ -24,6 +25,21 @@ our %QUOTED; +my %escape; +if (_BAD_BACKSLASH_ESCAPE) { + %escape = ( + (map +(chr($_) => sprintf '\x%02x', $_), 0 .. 0x31, 0x7f), + "\t" => "\\t", + "\n" => "\\n", + "\r" => "\\r", + "\f" => "\\f", + "\b" => "\\b", + "\a" => "\\a", + "\e" => "\\e", + (map +($_ => "\\$_"), qw(" \ $ @)), + ); +} + sub quotify { my $value = $_[0]; no warnings 'numeric'; @@ -32,9 +48,29 @@ : (!(_HAVE_IS_UTF8 && utf8::is_utf8($value)) && length( (my $dummy = '') & $value ) && 0 + $value eq $value - && $value * 0 == 0 - ) ? $value - : _HAVE_PERLSTRING ? B::perlstring($value) + ) ? ( + $value != $value ? ( + $value eq -CORE::sin(9**9**9) + ? '(-CORE::sin(9**9**9))' # -nan + : 'CORE::sin(9**9**9)' # nan + ) + : $value == 9**9**9 ? '(9**9**9)' # inf + : $value == -9**9**9 ? '(-9**9**9)' # -inf + : int($value) == $value ? $value # integer + : do { + my $float = sprintf('%.20f', $value); + $float =~ s/(\.[0-9]+?)0+\z/$1/; + $float; + } + ) + : !length($value) && eval { use warnings 'FATAL' => 'numeric'; $value == 0 } ? '(!1)' # false + : _BAD_BACKSLASH_ESCAPE && _HAVE_IS_UTF8 && utf8::is_utf8($value) ? do { + $value =~ s/(["\$\@\\[:cntrl:]]|[^\x00-\x7f])/ + $escape{$1} || sprintf('\x{%x}', ord($1)) + /ge; + qq["$value"]; + } + : _HAVE_PERLSTRING ? B::perlstring($value) : qq["\Q$value\E"]; } @@ -58,6 +94,8 @@ sub inlinify { my ($code, $args, $extra, $local) = @_; + $args = '()' + if !defined $args; my $do = 'do { '.($extra||''); if ($code =~ s/^(\s*package\s+([a-zA-Z0-9:]+);)//) { $do .= $1; @@ -234,7 +272,25 @@ . " }".($name ? "\n \$\$_UNQUOTED = \\&${name}" : '') . ";\n" . "}\n" . "1;\n"; - $ENV{SUB_QUOTE_DEBUG} && warn $make_sub; + if (my $debug = $ENV{SUB_QUOTE_DEBUG}) { + if ($debug =~ m{^([^\W\d]\w*(?:::\w+)*(?:::)?)$}) { + my $filter = $1; + my $match + = $filter =~ /::$/ ? $package.'::' + : $filter =~ /::/ ? $package.'::'.($name||'__ANON__') + : ($name||'__ANON__'); + warn $make_sub + if $match eq $filter; + } + elsif ($debug =~ m{\A/(.*)/\z}s) { + my $filter = $1; + warn $make_sub + if $code =~ $filter; + } + else { + warn $make_sub; + } + } { no strict 'refs'; local *{"${package}::${name}"} if $name; @@ -467,6 +523,37 @@ Sanitizes a value so that it can be used in an identifier. +=head1 ENVIRONMENT + +=head2 SUB_QUOTE_DEBUG + +Causes code to be output to C<STDERR> before being evaled. Several forms are +supported: + +=over 4 + +=item C<1> + +All subs will be output. + +=item C</foo/> + +Subs will be output if their code matches the given regular expression. + +=item C<simple_identifier> + +Any sub with the given name will be output. + +=item C<Full::identifier> + +A sub matching the full name will be output. + +=item C<Package::Name::> + +Any sub in the given package (including anonymous subs) will be output. + +=back + =head1 CAVEATS Much of this is just string-based code-generation, and as a result, a few diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/inline.t new/Sub-Quote-2.006003/t/inline.t --- old/Sub-Quote-2.005001/t/inline.t 2017-05-30 22:51:32.000000000 +0200 +++ new/Sub-Quote-2.006003/t/inline.t 2018-12-29 19:48:58.000000000 +0100 @@ -15,11 +15,13 @@ '$y' => \2, }; my $prelude = capture_unroll '$captures', $captures, 4; -my $out = eval - $prelude - . '[ $x, $y ]'; -is "$@", '', 'capture_unroll produces valid code'; -is_deeply $out, [ 1, 2 ], 'unrolled variables get correct values'; +{ + my $sub = eval + "sub { $prelude" + . '[ $x, $y ] }'; + is "$@", '', 'capture_unroll produces valid code'; + is_deeply $sub->(), [ 1, 2 ], 'unrolled variables get correct values'; +} like exception { capture_unroll '$captures', { '&foo' => \sub { 5 } }, 4; @@ -32,10 +34,10 @@ [ $x, $y ]; }, '$x, $y', $prelude; - my $out = eval $inlined_code; + my $sub = eval "sub { $inlined_code }"; is "$@", '', 'inlinify produces valid code' or diag "code:\n$inlined_code"; - is_deeply $out, [ 1, 2 ], 'inlinified code get correct values'; + is_deeply $sub->(), [ 1, 2 ], 'inlinified code get correct values'; unlike $inlined_code, qr/my \(\$x, \$y\) = \@_;/, "matching variables aren't reassigned"; } @@ -48,10 +50,10 @@ [ $x, $y, our $baz ]; }, '$x, $y', $prelude; - my $out = eval $inlined_code; + my $sub = eval "sub { $inlined_code }"; is "$@", '', 'inlinify produces valid code' or diag "code:\n$inlined_code"; - is_deeply $out, [ 1, 2, 3 ], 'inlinified code get correct values'; + is_deeply $sub->(), [ 1, 2, 3 ], 'inlinified code get correct values'; unlike $inlined_code, qr/my \(\$x, \$y\) = \@_;/, "matching variables aren't reassigned"; } @@ -62,10 +64,10 @@ [ $d, $f ]; }, '$x, $y', $prelude; - my $out = eval $inlined_code; + my $sub = eval "sub { $inlined_code }"; is "$@", '', 'inlinify with unmatched params produces valid code' or diag "code:\n$inlined_code"; - is_deeply $out, [ 1, 2 ], 'inlinified code get correct values'; + is_deeply $sub->(), [ 1, 2 ], 'inlinified code get correct values'; } { @@ -73,10 +75,52 @@ my $z = $_[0]; $z; }, '$y', $prelude; - my $out = eval $inlined_code; + my $sub = eval "sub { $inlined_code }"; is "$@", '', 'inlinify with out @_ produces valid code' or diag "code:\n$inlined_code"; - is $out, 2, 'inlinified code get correct values'; + is $sub->(), 2, 'inlinified code get correct values'; +} + +{ + my $inlined_code = inlinify q{ + my $z = $_[0]; + $z; + }, '@_', $prelude; + my $sub = eval "sub { $inlined_code }"; + is "$@", '', 'inlinify with @_ as args produces valid code' + or diag "code:\n$inlined_code"; + is $sub->(5), 5, 'inlinified code get correct values'; +} + +{ + my $inlined_code = inlinify q{ + my $z = $_[0]; + $z; + }, '$x', $prelude, 1; + my $sub = eval "sub { [ $inlined_code, \@_ ] }"; + is "$@", '', 'inlinify with local produces valid code' + or diag "code:\n$inlined_code"; + is_deeply $sub->(5), [1, 5], 'inlinified code get correct values'; +} + +{ + my $inlined_code = inlinify q{ + 219; + }, undef, $prelude; + my $sub = eval "sub { $inlined_code }"; + is "$@", '', 'inlinify without args produces valid code' + or diag "code:\n$inlined_code"; + is $sub->(), 219, 'inlinified code get correct values'; +} + +{ + my $inlined_code = inlinify q{ + 219; + }, '@_', undef; + my $sub = eval "sub { $inlined_code }"; + is "$@", '', 'inlinify without extra produces valid code' + or diag "code:\n$inlined_code"; + is $sub->(), 219, 'inlinified code get correct values'; } done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/quotify-5.6.t new/Sub-Quote-2.006003/t/quotify-5.6.t --- old/Sub-Quote-2.005001/t/quotify-5.6.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sub-Quote-2.006003/t/quotify-5.6.t 2018-12-29 19:48:58.000000000 +0100 @@ -0,0 +1,12 @@ +use strict; +use warnings; +no warnings 'once'; +use B; +BEGIN { + local $utf8::{is_utf8}; + local $B::{perlstring}; + require Sub::Quote; +} +die "Unable to disable utf8::is_utf8 and B::perlstring for testing" + unless !Sub::Quote::_HAVE_IS_UTF8 && ! Sub::Quote::_HAVE_PERLSTRING; +do './t/quotify.t' or die $@ || $!; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/quotify.t new/Sub-Quote-2.006003/t/quotify.t --- old/Sub-Quote-2.005001/t/quotify.t 2018-02-03 11:44:24.000000000 +0100 +++ new/Sub-Quote-2.006003/t/quotify.t 2019-01-28 16:16:37.000000000 +0100 @@ -6,25 +6,36 @@ use Data::Dumper; use B; -use constant HAVE_UTF8 => defined &utf8::upgrade && defined &utf8::is_utf8;; - use Sub::Quote qw( quotify ); +use constant HAVE_UTF8 => Sub::Quote::_HAVE_IS_UTF8; + sub _dump { my $value = shift; + if (!defined $value) { + return 'undef'; + } + elsif (is_strict_numeric($value)) { + return "$value"; + } local $Data::Dumper::Terse = 1; local $Data::Dumper::Useqq = 1; - my $d = Data::Dumper::Dumper($value); + my $d = Data::Dumper::Dumper("$value"); $d =~ s/\s+$//; $d; } sub is_numeric { - my $val = shift; - my $sv = B::svref_2object(\$val); - !!($sv->FLAGS & ( B::SVp_IOK | B::SVp_NOK ) ) + my $flags = B::svref_2object(\($_[0]))->FLAGS; + !!( $flags & ( B::SVp_IOK | B::SVp_NOK ) ) +} + +sub is_strict_numeric { + my $flags = B::svref_2object(\($_[0]))->FLAGS; + + !!( $flags & ( B::SVp_IOK | B::SVp_NOK ) && !( $flags & B::SVp_POK ) ) } my %flags; @@ -54,37 +65,43 @@ } } sub flags { - my $val = shift; - my $flags = B::svref_2object(\$val)->FLAGS; + my $flags = B::svref_2object(\($_[0]))->FLAGS; join ' ', sort grep $flags & $flags{$_}, keys %flags; } -BEGIN { - if (HAVE_UTF8) { - eval ' - sub eval_utf8 { - my $value = shift; - my $output; - eval "use utf8; \$output = $value; 1;" or die $@; - $output; - } - 1; - ' or die $@; - } +# unique values taking flags into account +sub _uniq { + my %s; + grep { + my $copy = $_; + my $key = defined $_ ? flags($_).'|'.(HAVE_UTF8 && utf8::is_utf8($_) ? 1 : 0)."|$copy" : ''; + !$s{$key}++; + } @_; +} + +sub eval_utf8 { + my $value = shift; + my $output; + eval "use utf8; \$output = $value; 1;" or die $@; + $output; } my @numbers = ( -20 .. 20, + qw(00 01 .0 .1 0.0 0.00 00.00 0.10 0.101 1e5 1e-5 1e50), '0 but true', (map 1 / $_, -10 .. -2, 2 .. 10), + 9**9**9, # inf + -9**9**9, # -inf + sin(9**9**9), # nan + -sin(9**9**9), # -nan ); my @strings = ( - "\x00", - "a", + "", + (map +chr($_), 0 .. 0xff), + "\\a\"", "\xC3\x84", - "\xE8", - "\xFC", - "\xFF", + "\x{ABCD}", "\x{1F4A9}", ); @@ -100,49 +117,81 @@ for @utf8_strings; } +my @booleans = (!1, !0); + my @quotify = ( undef, + @booleans, (map { - my $used_as_string = $_; - my $string = "$used_as_string"; - ($_, $used_as_string, $string); + my $indeterminate = $_; + my $number = $indeterminate + 0; + my $string = $indeterminate . ""; + ($number, $indeterminate, $string); } @numbers), @strings, @utf8_strings, ); +# HAVE_UTF8 will be artificially false under quotify-5.6.t. skip utf8 strings +# in this case as they will produce warnings or errors in newer perls. +@quotify = grep !utf8::is_utf8($_), @quotify + if !HAVE_UTF8 and "$]" >= 5.025; + my $eval_utf8; -for my $value (@quotify) { +for my $value (_uniq @quotify) { my $value_name = _dump($value) . (HAVE_UTF8 && utf8::is_utf8($value) ? ' utf8' : '') + . (is_strict_numeric($value) ? ' pure' : '') . (is_numeric($value) ? ' num' : ''); my $quoted = quotify(my $copy = $value); utf8::downgrade($quoted, 1) if HAVE_UTF8; + my $note = "quotified as $quoted"; + utf8::encode($note) + if defined &utf8::encode; + note $note; + is flags($copy), flags($value), "$value_name: quotify doesn't modify input"; my $evaled; eval "\$evaled = $quoted; 1" or die $@; - is is_numeric($evaled), is_numeric($value), - "$value_name: numeric status maintained"; - - is $value, $evaled, - "$value_name: value maintained"; - - if (HAVE_UTF8) { - my $utf8_evaled = eval_utf8($quoted); + for my $check ( + [ $evaled ], + ( HAVE_UTF8 ? [ eval_utf8($quoted), ' under utf8' ] : ()), + ) { + my ($check_value, $suffix) = @$check; + $suffix ||= ''; + + if (is_strict_numeric($value)) { + ok is_strict_numeric($check_value), + "$value_name: numeric status maintained$suffix"; + } - is is_numeric($value), is_numeric($utf8_evaled), - "$value_name: numeric status maintained under utf8"; + if (is_numeric($value)) { + if ($value == $value) { + cmp_ok $check_value, '==', $value, + "$value_name: numeric value maintained$suffix"; + } + else { + cmp_ok $check_value, '!=', $check_value, + "$value_name: numeric value maintained$suffix"; + } + } - is $value, $utf8_evaled, - "$value_name: value maintained under utf8"; + if (defined $value) { + cmp_ok $check_value, 'eq', $value, + "$value_name: string value maintained$suffix"; + } + else { + is $check_value, undef, + "$value_name: undef maintained$suffix"; + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/sub-defer-no-subname.t new/Sub-Quote-2.006003/t/sub-defer-no-subname.t --- old/Sub-Quote-2.005001/t/sub-defer-no-subname.t 2016-12-08 01:09:29.000000000 +0100 +++ new/Sub-Quote-2.006003/t/sub-defer-no-subname.t 2018-12-29 19:48:58.000000000 +0100 @@ -5,6 +5,8 @@ 'Sub::Name' => undef, 'Sub::Util' => undef, ; +use List::Util; +delete $Sub::Util::{set_subname}; do './t/sub-defer.t'; die $@ if $@; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/sub-defer-threads.t new/Sub-Quote-2.006003/t/sub-defer-threads.t --- old/Sub-Quote-2.005001/t/sub-defer-threads.t 2018-04-19 17:11:52.000000000 +0200 +++ new/Sub-Quote-2.006003/t/sub-defer-threads.t 2018-12-29 19:48:58.000000000 +0100 @@ -1,3 +1,9 @@ +BEGIN { + if ("$]" <= 5.008005) { + print "1..0 # SKIP threads too unstable until perl 5.8.5\n"; + exit 0; + } +} use lib 't/lib'; use ThreadsCheck; use strict; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/sub-defer.t new/Sub-Quote-2.006003/t/sub-defer.t --- old/Sub-Quote-2.005001/t/sub-defer.t 2018-02-07 00:46:31.000000000 +0100 +++ new/Sub-Quote-2.006003/t/sub-defer.t 2018-12-29 20:05:55.000000000 +0100 @@ -54,6 +54,14 @@ }; is($four_defer, \&Foo::four, 'four defer installed'); +my $unnamed_defer = defer_sub undef ,=> sub { + die 'remade - wtf' if $made{'unnamed'}; + $made{'unnamed'} = sub { 'dwarg' }; +}; +my $unnamed_result = $unnamed_defer->(); +ok $made{'unnamed'}, 'unnamed deferred subs generate subs'; +is $unnamed_result, 'dwarg', 'unnamed deferred subs call generated sub properly'; + # somebody somewhere wraps up around the deferred installer no warnings qw/redefine/; my $orig = Foo->can('four'); @@ -159,6 +167,16 @@ } { + my $error; + eval { + my $sub = defer_sub undef, sub { sub { "gorf" } }, { attributes => [ 'oh boy' ] }; + 1; + } or $error = $@; + like $error, qr/invalid attribute/, + 'invalid attributes are rejected'; +} + +{ my $guff; my $deferred = defer_sub "Foo::flub", sub { sub { $guff } }; my $undeferred = undefer_sub($deferred); @@ -287,4 +305,45 @@ 'defer_info on undeferred gives name, generator, options after undefer'; } +is defer_info(undef), undef, 'defer_info on undef gives undef'; + +{ + my $x; + my $sub = sub { + $x++; + (caller(0))[3]; + }; + Sub::Defer::_install_coderef('Blorp::foo', 'Farg::foo', $sub); + is \&Blorp::foo, $sub, + '_install_coderef properly installs subs'; + + SKIP: { + skip 'no sub naming module available', 1 + unless Sub::Defer::_CAN_SUBNAME; + + is Blorp::foo(), 'Farg::foo', + '_install_coderef properly names subs'; + } + my $sub2 = sub { + $x++; + (caller(0))[3]; + }; + Sub::Defer::_install_coderef('Blorp::foo', 'Farg::foo', $sub2); + is \&Blorp::foo, $sub2, + '_install_coderef properly replaces subs'; +} + +{ + my $x; + my $sub = sub { $x = 1; sub { $x } }; + my $deferred = defer_sub undef, $sub; + my $info = $Sub::Defer::DEFERRED{$deferred}; + undef $deferred; + # simulate reused memory address + @{$Sub::Defer::DEFERRED{$sub}} = @$info; + undefer_sub($sub); + is $x, undef, + 'undefer_sub does not operate on non-deferred sub with reused memory address'; +} + done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/sub-quote-threads.t new/Sub-Quote-2.006003/t/sub-quote-threads.t --- old/Sub-Quote-2.005001/t/sub-quote-threads.t 2018-04-19 17:11:52.000000000 +0200 +++ new/Sub-Quote-2.006003/t/sub-quote-threads.t 2018-12-29 19:48:58.000000000 +0100 @@ -1,3 +1,9 @@ +BEGIN { + if ("$]" <= 5.008005) { + print "1..0 # SKIP threads too unstable until perl 5.8.5\n"; + exit 0; + } +} use lib 't/lib'; use ThreadsCheck; use strict; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/sub-quote.t new/Sub-Quote-2.006003/t/sub-quote.t --- old/Sub-Quote-2.005001/t/sub-quote.t 2018-02-03 18:29:51.000000000 +0100 +++ new/Sub-Quote-2.006003/t/sub-quote.t 2018-12-29 20:05:55.000000000 +0100 @@ -170,11 +170,83 @@ my @warnings; local $ENV{SUB_QUOTE_DEBUG} = 1; local $SIG{__WARN__} = sub { push @warnings, @_ }; - my $sub = quote_sub q{ "this is in the quoted sub" }; - $sub->(); + + quote_sub(q{ "this is in the quoted sub" })->(); like $warnings[0], qr/sub\s*{.*this is in the quoted sub/s, - 'got debug info with SUB_QUOTE_DEBUG'; + "SUB_QUOTE_DEBUG - package doesn't match anon other"; + is scalar @warnings, 1, + 'single debug warning'; + + $ENV{SUB_QUOTE_DEBUG} = 'Some::Package::'; + + @warnings = (); + quote_sub(q{ "this is in the quoted sub" })->(); + is scalar @warnings, 0, + "SUB_QUOTE_DEBUG - package doesn't match anon other"; + + @warnings = (); + quote_sub('Some::Package::etc', q{ "this is in the quoted sub" })->(); + like $warnings[0], + qr/this is in the quoted sub/s, + "SUB_QUOTE_DEBUG - package matches"; + + @warnings = (); + quote_sub(q{ "this is in the quoted sub" }, {}, { package => 'Some::Package' })->(); + like $warnings[0], + qr/this is in the quoted sub/s, + "SUB_QUOTE_DEBUG - package matches anon"; + + $ENV{SUB_QUOTE_DEBUG} = 'etc'; + + @warnings = (); + quote_sub(q{ "this is in the quoted sub" })->(); + is scalar @warnings, 0, + "SUB_QUOTE_DEBUG - sub name doesn't match anon"; + + @warnings = (); + quote_sub('Some::Package::woop', q{ "this is in the quoted sub" })->(); + is scalar @warnings, 0, + "SUB_QUOTE_DEBUG - sub name doesn't match other"; + + @warnings = (); + quote_sub('Some::Package::etc', q{ "this is in the quoted sub" })->(); + like $warnings[0], + qr/this is in the quoted sub/s, + 'SUB_QUOTE_DEBUG - sub name matches'; + + @warnings = (); + quote_sub('Some::Other::Package::etc', q{ "this is in the quoted sub" })->(); + like $warnings[0], + qr/this is in the quoted sub/s, + 'SUB_QUOTE_DEBUG - sub name matches'; + + $ENV{SUB_QUOTE_DEBUG} = 'Some::Package::foo'; + + @warnings = (); + quote_sub('Some::Package::foo', q{ "this is in the quoted sub" })->(); + like $warnings[0], + qr/this is in the quoted sub/s, + 'SUB_QUOTE_DEBUG - fully qualified matches'; + + @warnings = (); + quote_sub('Some::Other::Package::foo', q{ "this is in the quoted sub" })->(); + is scalar @warnings, + 0, + "SUB_QUOTE_DEBUG - fully qualified doesn't match other"; + + $ENV{SUB_QUOTE_DEBUG} = '/quoted/'; + + @warnings = (); + quote_sub('Some::Package::quoted', q{ "this sub should not match" })->(); + is scalar @warnings, + 0, + "SUB_QUOTE_DEBUG - regex doesn't match name"; + + quote_sub(q{ "this is in the quoted sub" })->(); + like $warnings[0], + qr/this is in the quoted sub/s, + "SUB_QUOTE_DEBUG - regex matches code"; } { @@ -195,6 +267,8 @@ 'evaled immediately with no_defer option (named)'; ok defined &No::Defer::Test, 'sub installed with no_defer option'; + is No::Defer::Test(), 1, + 'sub callable with no_defer option'; } { @@ -248,6 +322,21 @@ } { + my $error; + eval { + my $sub = quote_sub q{ "gorf" }, {}, { attributes => [ 'oh boy' ] }; + 1; + } or $error = $@; + like $error, qr/invalid attribute/, + 'invalid attributes are rejected'; +} + +{ + my $sub = quote_sub q{ sub { join " line ", (caller(0))[1,2] }->() }, {}, { line => 42 }; + like $sub->(), qr/eval.* line 42\b/, "line provided"; +} + +{ my $sub = quote_sub q{ sub { join " line ", (caller(0))[1,2] }->() }, {}, { file => "welp.pl", line => 42 }; is $sub->(), "welp.pl line 42", "file and line provided"; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/subname-none.t new/Sub-Quote-2.006003/t/subname-none.t --- old/Sub-Quote-2.005001/t/subname-none.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sub-Quote-2.006003/t/subname-none.t 2018-12-29 19:48:58.000000000 +0100 @@ -0,0 +1,24 @@ +use strict; +use warnings; +no warnings 'once'; +use lib 't/lib'; + +use Test::More; +use List::Util; +BEGIN { + delete $Sub::Util::{'set_subname'}; + delete $INC{'Sub/Util.pm'}; +} + +use InlineModule + 'Sub::Name' => undef, + 'Sub::Util' => undef, +; + +use Sub::Defer; + +ok !Sub::Defer::_CAN_SUBNAME; +my $sub = sub { 'foo' }; +is Sub::Defer::_subname('foo', $sub), $sub; + +done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/subname-sub-name-preload.t new/Sub-Quote-2.006003/t/subname-sub-name-preload.t --- old/Sub-Quote-2.005001/t/subname-sub-name-preload.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sub-Quote-2.006003/t/subname-sub-name-preload.t 2018-12-29 19:48:58.000000000 +0100 @@ -0,0 +1,33 @@ +use strict; +use warnings; +no warnings 'once'; +use lib 't/lib'; + +use Test::More; +use List::Util; +BEGIN { + delete $Sub::Util::{'set_subname'}; + delete $INC{'Sub/Util.pm'}; +} + +use InlineModule + 'Sub::Name' => <<'END_SN', +package Sub::Name; +sub subname { + $::sub_named = $_[0]; + return $_[1]; +} +1; +END_SN + 'Sub::Util' => undef, +; + +use Sub::Name; +use Sub::Defer; + +ok Sub::Defer::_CAN_SUBNAME; +my $sub = sub { 'foo' }; +is Sub::Defer::_subname('foo', $sub), $sub; +is $::sub_named, 'foo'; + +done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/subname-sub-name.t new/Sub-Quote-2.006003/t/subname-sub-name.t --- old/Sub-Quote-2.005001/t/subname-sub-name.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sub-Quote-2.006003/t/subname-sub-name.t 2018-12-29 19:48:58.000000000 +0100 @@ -0,0 +1,32 @@ +use strict; +use warnings; +no warnings 'once'; +use lib 't/lib'; + +use Test::More; +use List::Util; +BEGIN { + delete $Sub::Util::{'set_subname'}; + delete $INC{'Sub/Util.pm'}; +} + +use InlineModule + 'Sub::Name' => <<'END_SN', +package Sub::Name; +sub subname { + $::sub_named = $_[0]; + return $_[1]; +} +1; +END_SN + 'Sub::Util' => undef, +; + +use Sub::Defer; + +ok Sub::Defer::_CAN_SUBNAME; +my $sub = sub { 'foo' }; +is Sub::Defer::_subname('foo', $sub), $sub; +is $::sub_named, 'foo'; + +done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sub-Quote-2.005001/t/subname-sub-util.t new/Sub-Quote-2.006003/t/subname-sub-util.t --- old/Sub-Quote-2.005001/t/subname-sub-util.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sub-Quote-2.006003/t/subname-sub-util.t 2018-12-29 19:48:58.000000000 +0100 @@ -0,0 +1,32 @@ +use strict; +use warnings; +no warnings 'once'; +use lib 't/lib'; + +use Test::More; +use List::Util; +BEGIN { + delete $Sub::Util::{'set_subname'}; + delete $INC{'Sub/Util.pm'}; +} + +use InlineModule + 'Sub::Name' => undef, + 'Sub::Util' => <<'END_SU', +package Sub::Util; +sub set_subname { + $::sub_named = $_[0]; + return $_[1]; +} +1; +END_SU +; + +use Sub::Defer; + +ok Sub::Defer::_CAN_SUBNAME; +my $sub = sub { 'foo' }; +is Sub::Defer::_subname('foo', $sub), $sub; +is $::sub_named, 'foo'; + +done_testing;
