B-Hooks-EndOfScope-0.12/000075500000000000000000000000001215633244400146635ustar00rootroot00000000000000B-Hooks-EndOfScope-0.12/Changes000064400000000000000000000034131215633244400161570ustar00rootroot000000000000000.12 Tue, 4 Dec 2012 20:13:00 +0000 * Complete pure-perl implementation in addition to the one based on Variable::Magic. You can specify the implementation explicitly by use-ing B::Hooks::EndOfScope::PP or B::Hooks::EndOfScope::XS, or by setting $ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} to either 'XS' or 'PP' * Switch from using Sub::Exporter to the more conservative Sub::Exporter::Progressive 0.11 Thu, 23 Feb 2012 11:19:18 +0100 * A minor efficiency improvement. 0.10 Thu, 16 Feb 2012 09:41:54 +0100 * Stop propagating our magic through localisation. 0.09 Fri, 07 May 2010 22:11:49 +0200 * Improve distribution metadata. 0.08 Sun, 19 Apr 2009 19:15:44 +0200 * Depend on Variable::Magic 0.34 so exceptions during compile time that trigger a destructor don't cause an exception on 5.10 anymore. 0.07 Fri, 20 Feb 2009 14:22:16 +0100 * Depend on Variable::Magic 0.31 so exceptions thrown in on_scope_end blocks don't lose their error message. 0.06 Mon, 19 Jan 2009 00:51:45 +0100 * Depend on Variable::Magic 0.27 to stop exceptions thrown in on_scope_end blocks from segfaulting. Also add a test for that. 0.05 Sun, 04 Jan 2009 20:46:07 +0100 * Use Variable::Magic and cast %^H instead Scope::Guard and relying on a timely destruction of objects within %^H. This fixes using on_scope_end in blocks where string evals are compiled as those increment the refcount of objects in %^H on 5.10. 0.04 Mon, 20 Oct 2008 12:56:23 +0200 * Remove an unused bit from the $^H mask. 0.03 Mon, 20 Oct 2008 06:53:20 +0200 * Improve testing of multiple hooks. * More documentation. * Require perl 5.8.0. 0.02 Sun, 19 Oct 2008 10:25:15 +0200 * Specify all dependencies. 0.01 Sun, 19 Oct 2008 09:29:13 +0200 * Initial release. B-Hooks-EndOfScope-0.12/LICENSE000064400000000000000000000436641215633244400157050ustar00rootroot00000000000000This software is copyright (c) 2012 by Florian Ragwitz. 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) 2012 by Florian Ragwitz. 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, Suite 500, Boston, MA 02110-1335 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) 2012 by Florian Ragwitz. 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 B-Hooks-EndOfScope-0.12/MANIFEST000064400000000000000000000007171215633244400160210ustar00rootroot00000000000000Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/B/Hooks/EndOfScope.pm lib/B/Hooks/EndOfScope/PP.pm lib/B/Hooks/EndOfScope/PP/FieldHash.pm lib/B/Hooks/EndOfScope/PP/HintHash.pm lib/B/Hooks/EndOfScope/XS.pm t/00-basic.t t/01-eval.t t/02-localise.t t/05-exception_xs.t t/06-exception_pp.t t/10-test_without_vm_pure_pp.t t/11-direct_xs.t t/12-direct_pp.t t/release-eol.t t/release-no-tabs.t t/release-pod-coverage.t t/release-pod-syntax.t B-Hooks-EndOfScope-0.12/META.json000064400000000000000000000173241215633244400163130ustar00rootroot00000000000000{ "abstract" : "Execute code after a scope finished compilation", "author" : [ "Florian Ragwitz ", "Peter Rabbitson " ], "dynamic_config" : "1", "generated_by" : "Dist::Zilla version 4.300028, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "B-Hooks-EndOfScope", "prereqs" : { "configure" : { "requires" : { "ExtUtils::CBuilder" : "0.26", "ExtUtils::MakeMaker" : "6.30" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "Module::Implementation" : "0.05", "Module::Runtime" : "0.012", "Sub::Exporter::Progressive" : "0.001006" } }, "test" : { "requires" : { "Test::More" : "0.88" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-B-Hooks-EndOfScope@rt.cpan.org", "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=B-Hooks-EndOfScope" }, "homepage" : "http://metacpan.org/release/B-Hooks-EndOfScope", "repository" : { "type" : "git", "url" : "git://github.com/rafl/b-hooks-endofscope.git", "web" : "http://github.com/rafl/b-hooks-endofscope" } }, "version" : "0.12", "x_Dist_Zilla" : { "perl" : { "version" : "5.016000" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "runtime", "type" : "requires" } }, "name" : "Prereqs", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "TestRequires", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "configure", "type" : "requires" } }, "name" : "ConfigureRequires", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::Metadata", "name" : "Metadata", "version" : "3.03" }, { "class" : "Dist::Zilla::Plugin::MakeMaker::Custom", "name" : "MakeMaker::Custom", "version" : "4.11" }, { "class" : "Dist::Zilla::Plugin::GatherDir", "name" : "@Filter/@Basic/GatherDir", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Filter/@Basic/PruneCruft", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Filter/@Basic/ManifestSkip", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Filter/@Basic/MetaYAML", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Filter/@Basic/License", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@Filter/@Basic/Readme", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::ExtraTests", "name" : "@Filter/@Basic/ExtraTests", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Filter/@Basic/ExecDir", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Filter/@Basic/ShareDir", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Filter/@Basic/Manifest", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Filter/@Basic/TestRelease", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Filter/@Basic/ConfirmRelease", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Filter/@Basic/UploadToCPAN", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Filter/MetaConfig", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Filter/MetaJSON", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@Filter/PkgVersion", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@Filter/PodSyntaxTests", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::NoTabsTests", "name" : "@Filter/NoTabsTests", "version" : "0.01" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@Filter/PodCoverageTests", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@Filter/MetaResources", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@Filter/Authority", "version" : "1.006" }, { "class" : "Dist::Zilla::Plugin::EOLTests", "name" : "@Filter/EOLTests", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "name" : "@Filter/PodWeaver", "version" : "3.101641" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "4.300028" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "4.300028" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : "0" }, "version" : "4.300028" } }, "x_authority" : "cpan:FLORA" } B-Hooks-EndOfScope-0.12/META.yml000064400000000000000000000115521215633244400161400ustar00rootroot00000000000000--- abstract: 'Execute code after a scope finished compilation' author: - 'Florian Ragwitz ' - 'Peter Rabbitson ' build_requires: Test::More: 0.88 configure_requires: ExtUtils::CBuilder: 0.26 ExtUtils::MakeMaker: 6.30 dynamic_config: 1 generated_by: 'Dist::Zilla version 4.300028, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: B-Hooks-EndOfScope requires: Module::Implementation: 0.05 Module::Runtime: 0.012 Sub::Exporter::Progressive: 0.001006 resources: bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=B-Hooks-EndOfScope homepage: http://metacpan.org/release/B-Hooks-EndOfScope repository: git://github.com/rafl/b-hooks-endofscope.git version: 0.12 x_Dist_Zilla: perl: version: 5.016000 plugins: - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: runtime type: requires name: Prereqs version: 4.300028 - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: TestRequires version: 4.300028 - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: configure type: requires name: ConfigureRequires version: 4.300028 - class: Dist::Zilla::Plugin::Metadata name: Metadata version: 3.03 - class: Dist::Zilla::Plugin::MakeMaker::Custom name: MakeMaker::Custom version: 4.11 - class: Dist::Zilla::Plugin::GatherDir name: '@Filter/@Basic/GatherDir' version: 4.300028 - class: Dist::Zilla::Plugin::PruneCruft name: '@Filter/@Basic/PruneCruft' version: 4.300028 - class: Dist::Zilla::Plugin::ManifestSkip name: '@Filter/@Basic/ManifestSkip' version: 4.300028 - class: Dist::Zilla::Plugin::MetaYAML name: '@Filter/@Basic/MetaYAML' version: 4.300028 - class: Dist::Zilla::Plugin::License name: '@Filter/@Basic/License' version: 4.300028 - class: Dist::Zilla::Plugin::Readme name: '@Filter/@Basic/Readme' version: 4.300028 - class: Dist::Zilla::Plugin::ExtraTests name: '@Filter/@Basic/ExtraTests' version: 4.300028 - class: Dist::Zilla::Plugin::ExecDir name: '@Filter/@Basic/ExecDir' version: 4.300028 - class: Dist::Zilla::Plugin::ShareDir name: '@Filter/@Basic/ShareDir' version: 4.300028 - class: Dist::Zilla::Plugin::Manifest name: '@Filter/@Basic/Manifest' version: 4.300028 - class: Dist::Zilla::Plugin::TestRelease name: '@Filter/@Basic/TestRelease' version: 4.300028 - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Filter/@Basic/ConfirmRelease' version: 4.300028 - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Filter/@Basic/UploadToCPAN' version: 4.300028 - class: Dist::Zilla::Plugin::MetaConfig name: '@Filter/MetaConfig' version: 4.300028 - class: Dist::Zilla::Plugin::MetaJSON name: '@Filter/MetaJSON' version: 4.300028 - class: Dist::Zilla::Plugin::PkgVersion name: '@Filter/PkgVersion' version: 4.300028 - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Filter/PodSyntaxTests' version: 4.300028 - class: Dist::Zilla::Plugin::NoTabsTests name: '@Filter/NoTabsTests' version: 0.01 - class: Dist::Zilla::Plugin::PodCoverageTests name: '@Filter/PodCoverageTests' version: 4.300028 - class: Dist::Zilla::Plugin::MetaResources name: '@Filter/MetaResources' version: 4.300028 - class: Dist::Zilla::Plugin::Authority name: '@Filter/Authority' version: 1.006 - class: Dist::Zilla::Plugin::EOLTests name: '@Filter/EOLTests' version: 0.02 - class: Dist::Zilla::Plugin::PodWeaver name: '@Filter/PodWeaver' version: 3.101641 - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: 4.300028 - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: 4.300028 - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: 4.300028 - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: 4.300028 - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: 4.300028 - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: 4.300028 zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: 4.300028 x_authority: cpan:FLORA B-Hooks-EndOfScope-0.12/Makefile.PL000064400000000000000000000065531215633244400166460ustar00rootroot00000000000000use strict; use warnings; use ExtUtils::MakeMaker; my $mymeta_works = eval { ExtUtils::MakeMaker->VERSION('6.5707'); 1 }; my $mymeta = $mymeta_works || eval { ExtUtils::MakeMaker->VERSION('6.5702'); 1 }; my %BUILD_DEPS = ( # this is liquid horror!!! (but so seems the entire MakeMaker::Custom) 'Test::More' => '0.88' ); my %RUN_DEPS = ( # this is liquid horror!!! (but so seems the entire MakeMaker::Custom) 'Module::Implementation' => '0.05', 'Module::Runtime' => '0.012', 'Sub::Exporter::Progressive' => '0.001006' ); my %OPT_RUN_DEPS = (can_xs() ? ( 'Variable::Magic' => '0.48', # when changing, also change it in B::Hooks::EndOfScope::XS # make sure we smoke the pure-perl version fallback is_smoker() ? ( 'Devel::Hide' => '0.0007' ) : (), ) : () ); my %WriteMakefileArgs = ( "NAME" => "B::Hooks::EndOfScope", "ABSTRACT" => "Execute code after a scope finished compilation", "AUTHOR" => "Florian Ragwitz ", "DISTNAME" => "B-Hooks-EndOfScope", "LICENSE" => "perl", "VERSION_FROM" => 'lib/B/Hooks/EndOfScope.pm', "test" => { "TESTS" => "t/*.t" }, 'CONFIGURE_REQUIRES' => { 'ExtUtils::CBuilder' => '0.26', 'ExtUtils::MakeMaker' => '6.30' }, "PREREQ_PM" => { %RUN_DEPS, %OPT_RUN_DEPS, $mymeta_works ? () : (%BUILD_DEPS), }, $mymeta_works ? ( # BUILD_REQUIRES makes MYMETA right, requires stops META being wrong "BUILD_REQUIRES" => \%BUILD_DEPS, "META_ADD" => { requires => \%RUN_DEPS, }, ) : ( # META_ADD both to get META right - only Makefile written "META_ADD" => { requires => \%RUN_DEPS, build_requires => \%BUILD_DEPS, }, ) , ($mymeta and !$mymeta_works) ? ( 'NO_MYMETA' => 1 ) : (), ); unless ( eval { ExtUtils::MakeMaker->VERSION('6.56') } ) { my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; my $pp = $WriteMakefileArgs{PREREQ_PM}; for my $mod ( keys %$br ) { if ( exists $pp->{$mod} ) { $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; } else { $pp->{$mod} = $br->{$mod}; } } } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION('6.52') }; WriteMakefile(%WriteMakefileArgs); # Secondary compile testing via ExtUtils::CBuilder sub can_xs { # Do we have the configure_requires checker? local $@; eval "require ExtUtils::CBuilder;"; if (! $@ ) { # They don't obey configure_requires, so it is # someone old and delicate. Try to avoid hurting # them by falling back to an older simpler test. return can_cc(); } return ExtUtils::CBuilder->new( quiet => 1 )->have_compiler; } # can we locate a (the) C compiler sub can_cc { my @chunks = split(/ /, $Config::Config{cc}) or return; # $Config{cc} may contain args; try to find out the program part while (@chunks) { return can_run("@chunks") || (pop(@chunks), next); } return; } # check if we can run some command sub can_run { my ($cmd) = @_; return $cmd if -x $cmd; if (my $found_cmd = MM->maybe_command($cmd)) { return $found_cmd; } for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { next if $dir eq ''; my $abs = File::Spec->catfile($dir, $cmd); return $abs if (-x $abs or $abs = MM->maybe_command($abs)); } return; } # is this a smoker? sub is_smoker { return ( $ENV{AUTOMATED_TESTING} && ! $ENV{RELEASE_TESTING} ) } B-Hooks-EndOfScope-0.12/README000064400000000000000000000005011215633244400155370ustar00rootroot00000000000000 This archive contains the distribution B-Hooks-EndOfScope, version 0.12: Execute code after a scope finished compilation This software is copyright (c) 2012 by Florian Ragwitz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. B-Hooks-EndOfScope-0.12/dist.ini000064400000000000000000000012351215633244400163300ustar00rootroot00000000000000name = B-Hooks-EndOfScope version = 0.12 author = Florian Ragwitz author = Peter Rabbitson license = Perl_5 copyright_holder = Florian Ragwitz [Prereqs] Module::Runtime = 0.012 Sub::Exporter::Progressive = 0.001006 Module::Implementation = 0.05 [Prereqs / TestRequires ] ; provide done_testing() Test::More = 0.88 [Prereqs / ConfigureRequires ] ; for proper can_xs ; ribasushi, I think you want EU::CB 0.26 minimum ExtUtils::CBuilder = 0.26 [Metadata] dynamic_config = 1 [MakeMaker::Custom] [@Filter] -bundle = @FLORA -remove = MakeMaker -remove = AutoPrereqs dist = B-Hooks-EndOfScope repository_at = github B-Hooks-EndOfScope-0.12/lib/000075500000000000000000000000001215633244400154315ustar00rootroot00000000000000B-Hooks-EndOfScope-0.12/lib/B/000075500000000000000000000000001215633244400156125ustar00rootroot00000000000000B-Hooks-EndOfScope-0.12/lib/B/Hooks/000075500000000000000000000000001215633244400166755ustar00rootroot00000000000000B-Hooks-EndOfScope-0.12/lib/B/Hooks/EndOfScope.pm000064400000000000000000000050511215633244400212210ustar00rootroot00000000000000package B::Hooks::EndOfScope; BEGIN { $B::Hooks::EndOfScope::AUTHORITY = 'cpan:FLORA'; } { $B::Hooks::EndOfScope::VERSION = '0.12'; } # ABSTRACT: Execute code after a scope finished compilation use strict; use warnings; # note - a %^H tie() fallback will probably work on 5.6 as well, # if you need to go that low - sane patches passing *all* tests # will be gladly accepted use 5.008001; BEGIN { require Module::Implementation; my $impl = Module::Implementation::implementation_for('B::Hooks::EndOfScope') || do { Module::Implementation::build_loader_sub( implementations => [ 'XS', 'PP' ], symbols => [ 'on_scope_end' ], )->(); Module::Implementation::implementation_for('B::Hooks::EndOfScope'); }; *on_scope_end = $impl eq 'XS' ? \&B::Hooks::EndOfScope::XS::on_scope_end : \&B::Hooks::EndOfScope::PP::on_scope_end ; } use Sub::Exporter::Progressive -setup => { exports => [ 'on_scope_end' ], groups => { default => ['on_scope_end'] }, }; 1; __END__ =pod =encoding utf-8 =head1 NAME B::Hooks::EndOfScope - Execute code after a scope finished compilation =head1 SYNOPSIS on_scope_end { ... }; =head1 DESCRIPTION This module allows you to execute code when perl finished compiling the surrounding scope. =head1 FUNCTIONS =head2 on_scope_end on_scope_end { ... }; on_scope_end $code; Registers C<$code> to be executed after the surrounding scope has been compiled. This is exported by default. See L on how to customize it. =head1 PURE-PERL MODE CAVEAT While L has access to some very dark sorcery to make it possible to throw an exception from within a callback, the pure-perl implementation does not have access to these hacks. Therefore, what would have been a compile-time exception is instead converted to a warning, and your execution will continue as if the exception never happened. To explicitly request an XS (or PP) implementation one has two choices. Either to import from the desired implementation explicitly: use B::Hooks::EndOfScope::XS or use B::Hooks::EndOfScope::PP or by setting C<$ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION}> to either C or C. =head1 SEE ALSO L L =head1 AUTHORS =over 4 =item * Florian Ragwitz =item * Peter Rabbitson =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Florian Ragwitz. 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 B-Hooks-EndOfScope-0.12/lib/B/Hooks/EndOfScope/000075500000000000000000000000001215633244400206625ustar00rootroot00000000000000B-Hooks-EndOfScope-0.12/lib/B/Hooks/EndOfScope/PP.pm000064400000000000000000000050661215633244400215460ustar00rootroot00000000000000package B::Hooks::EndOfScope::PP; BEGIN { $B::Hooks::EndOfScope::PP::AUTHORITY = 'cpan:FLORA'; } { $B::Hooks::EndOfScope::PP::VERSION = '0.12'; } # ABSTRACT: Execute code after a scope finished compilation - PP implementation use warnings; use strict; use Module::Runtime 'require_module'; use constant _PERL_VERSION => "$]"; BEGIN { if (_PERL_VERSION =~ /^5\.009/) { # CBA to figure out where %^H got broken and which H::U::HH is sane enough die "By design B::Hooks::EndOfScope does not operate in pure-perl mode on perl 5.9.X\n" } elsif (_PERL_VERSION < '5.010') { require_module('B::Hooks::EndOfScope::PP::HintHash'); *on_scope_end = \&B::Hooks::EndOfScope::PP::HintHash::on_scope_end; } else { require_module('B::Hooks::EndOfScope::PP::FieldHash'); *on_scope_end = \&B::Hooks::EndOfScope::PP::FieldHash::on_scope_end; } } use Sub::Exporter::Progressive -setup => { exports => ['on_scope_end'], groups => { default => ['on_scope_end'] }, }; sub __invoke_callback { local $@; eval { $_[0]->(); 1 } or do { my $err = $@; require Carp; Carp::cluck( (join ' ', 'A scope-end callback raised an exception, which can not be propagated when', 'B::Hooks::EndOfScope operates in pure-perl mode. Your program will CONTINUE', 'EXECUTION AS IF NOTHING HAPPENED AFTER THIS WARNING. Below is the complete', 'exception text, followed by a stack-trace of the callback execution:', ) . "\n\n$err\n\r" ); sleep 1 if -t *STDERR; # maybe a bad idea...? }; } 1; __END__ =pod =encoding utf-8 =head1 NAME B::Hooks::EndOfScope::PP - Execute code after a scope finished compilation - PP implementation =head1 DESCRIPTION This is the pure-perl implementation of L based only on modules available as part of the perl core. Its leaner sibling L will be automatically preferred if all dependencies are available and C<$ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION}> is not set to C<'PP'>. =head1 FUNCTIONS =head2 on_scope_end on_scope_end { ... }; on_scope_end $code; Registers C<$code> to be executed after the surrounding scope has been compiled. This is exported by default. See L on how to customize it. =head1 AUTHORS =over 4 =item * Florian Ragwitz =item * Peter Rabbitson =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Florian Ragwitz. 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 B-Hooks-EndOfScope-0.12/lib/B/Hooks/EndOfScope/PP/000075500000000000000000000000001215633244400212015ustar00rootroot00000000000000B-Hooks-EndOfScope-0.12/lib/B/Hooks/EndOfScope/PP/FieldHash.pm000064400000000000000000000027631215633244400233760ustar00rootroot00000000000000# Implementtion of a pure-perl on_scope_end for perls > 5.10 # (relies on Hash::Util:FieldHash) package # hide from pause B::Hooks::EndOfScope::PP::FieldHash; use strict; use warnings; use warnings; use strict; use Tie::Hash (); use Hash::Util::FieldHash 'fieldhash'; # Here we rely on a combination of several behaviors: # # * %^H is deallocated on scope exit, so any references to it disappear # * A lost weakref in a fieldhash causes the corresponding key to be deleted # * Deletion of a key on a tied hash triggers DELETE # # Therefore the DELETE of a tied fieldhash containing a %^H reference will # be the hook to fire all our callbacks. fieldhash my %hh; { package # hide from pause too B::Hooks::EndOfScope::PP::_TieHintHashFieldHash; use base 'Tie::StdHash'; sub DELETE { my $ret = shift->SUPER::DELETE(@_); B::Hooks::EndOfScope::PP::__invoke_callback($_) for @$ret; $ret; } } sub on_scope_end (&) { $^H |= 0x020000; tie(%hh, 'B::Hooks::EndOfScope::PP::_TieHintHashFieldHash') unless tied %hh; push @{ $hh{\%^H} ||= [] }, shift; } 1; __END__ =pod =encoding utf-8 =head1 NAME B::Hooks::EndOfScope::PP::FieldHash =head1 AUTHORS =over 4 =item * Florian Ragwitz =item * Peter Rabbitson =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Florian Ragwitz. 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 B-Hooks-EndOfScope-0.12/lib/B/Hooks/EndOfScope/PP/HintHash.pm000064400000000000000000000026251215633244400232520ustar00rootroot00000000000000# Implementtion of a pure-perl on_scope_end for perl 5.8.X # (relies on lack of compile/runtime duality of %^H before 5.10 # which makes guard object operation possible) package # hide from the pauses B::Hooks::EndOfScope::PP::HintHash; use strict; use warnings; use Scalar::Util (); # This is the original implementation, which sadly is broken # on perl 5.10+ within string evals sub on_scope_end (&) { $^H |= 0x020000; # localised %^H behaves funny on 5.8 - a # 'local %^H;' # is in effect the same as # 'local %^H = %^H;' # therefore make sure we use different keys so that things do not # fire too early due to hashkey overwrite push @{ $^H{sprintf '__B_H_EOS__guardstack_0X%x', Scalar::Util::refaddr(\%^H) } ||= bless ([], 'B::Hooks::EndOfScope::PP::_SG_STACK') }, shift; } package # hide from the pauses B::Hooks::EndOfScope::PP::_SG_STACK; use warnings; use strict; sub DESTROY { B::Hooks::EndOfScope::PP::__invoke_callback($_) for @{$_[0]}; } 1; __END__ =pod =encoding utf-8 =head1 NAME B::Hooks::EndOfScope::PP::HintHash =head1 AUTHORS =over 4 =item * Florian Ragwitz =item * Peter Rabbitson =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Florian Ragwitz. 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 B-Hooks-EndOfScope-0.12/lib/B/Hooks/EndOfScope/XS.pm000064400000000000000000000043141215633244400215540ustar00rootroot00000000000000package B::Hooks::EndOfScope::XS; BEGIN { $B::Hooks::EndOfScope::XS::AUTHORITY = 'cpan:FLORA'; } { $B::Hooks::EndOfScope::XS::VERSION = '0.12'; } # ABSTRACT: Execute code after a scope finished compilation - XS implementation use strict; use warnings; BEGIN { require Module::Runtime; # Adjust the Makefile.PL if changing this minimum version Module::Runtime::use_module('Variable::Magic', '0.48'); } use Sub::Exporter::Progressive -setup => { exports => ['on_scope_end'], groups => { default => ['on_scope_end'] }, }; my $wiz = Variable::Magic::wizard data => sub { [$_[1]] }, free => sub { $_->() for @{ $_[1] }; () }, # When someone localise %^H, our magic doesn't want to be copied # down. We want it to be around only for the scope we've initially # attached ourselfs to. Merely having MGf_LOCAL and a noop svt_local # callback achieves this. If anything wants to attach more magic of our # kind to a localised %^H, things will continue to just work as we'll be # attached with a new and empty callback list. local => \undef ; sub on_scope_end (&) { my $cb = shift; $^H |= 0x020000; if (my $stack = Variable::Magic::getdata %^H, $wiz) { push @{ $stack }, $cb; } else { Variable::Magic::cast %^H, $wiz, $cb; } } 1; __END__ =pod =encoding utf-8 =head1 NAME B::Hooks::EndOfScope::XS - Execute code after a scope finished compilation - XS implementation =head1 DESCRIPTION This is the implementation of L based on L, which is an XS module dependent on a compiler. It will always be automatically preferred if L is available. =head1 FUNCTIONS =head2 on_scope_end on_scope_end { ... }; on_scope_end $code; Registers C<$code> to be executed after the surrounding scope has been compiled. This is exported by default. See L on how to customize it. =head1 AUTHORS =over 4 =item * Florian Ragwitz =item * Peter Rabbitson =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Florian Ragwitz. 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 B-Hooks-EndOfScope-0.12/t/000075500000000000000000000000001215633244400151265ustar00rootroot00000000000000B-Hooks-EndOfScope-0.12/t/00-basic.t000064400000000000000000000010451215633244400166110ustar00rootroot00000000000000use strict; use warnings; use Test::More; BEGIN { use_ok('B::Hooks::EndOfScope') } BEGIN { ok(exists &on_scope_end, 'on_scope_end imported'); is(prototype('on_scope_end'), '&', '.. and has the right prototype'); } our ($i, $called); BEGIN { $i = 0 } sub foo { BEGIN { on_scope_end { $called = 1; $i = 42 }; on_scope_end { $i = 1 }; }; is($i, 1, 'value still set at runtime'); } BEGIN { ok($called, 'first callback invoked'); is($i, 1, '.. but the second is invoked later') } foo(); done_testing; B-Hooks-EndOfScope-0.12/t/01-eval.t000064400000000000000000000004051215633244400164570ustar00rootroot00000000000000use strict; use warnings; use Test::More; use B::Hooks::EndOfScope; our $called; sub foo { BEGIN { on_scope_end { $called = 1 } } # uncomment this to make the test pass eval '42'; } BEGIN { ok($called, 'callback invoked'); } done_testing; B-Hooks-EndOfScope-0.12/t/02-localise.t000064400000000000000000000013601215633244400173250ustar00rootroot00000000000000use strict; use warnings; use Test::More 0.89; use B::Hooks::EndOfScope; { my $fired; { BEGIN { on_scope_end { $fired++ } } BEGIN { ok(!$fired) } BEGIN { local %^H } BEGIN { ok(!$fired) } } BEGIN { ok($fired) } } { my $fired; { BEGIN { on_scope_end { $fired++ } } BEGIN { ok(!$fired) } BEGIN { local %^H; my $fired2; { BEGIN { on_scope_end { $fired2++ } } BEGIN { ok(!$fired2) } BEGIN { local %^H } BEGIN { ok(!$fired2) } } BEGIN { ok($fired2) } } BEGIN { ok(!$fired) } } BEGIN { ok($fired) } } done_testing; B-Hooks-EndOfScope-0.12/t/05-exception_xs.t000064400000000000000000000004731215633244400202510ustar00rootroot00000000000000use strict; use warnings; use Test::More; use B::Hooks::EndOfScope; plan skip_all => 'Skiping XS test in PP mode' unless $INC{'B/Hooks/EndOfScope/XS.pm'}; eval q[ sub foo { BEGIN { on_scope_end { die 'bar' }; } } ]; like($@, qr/^bar/); pass('no segfault'); done_testing; B-Hooks-EndOfScope-0.12/t/06-exception_pp.t000064400000000000000000000010651215633244400202350ustar00rootroot00000000000000use strict; use warnings; use Test::More; use B::Hooks::EndOfScope; plan skip_all => 'Skipping PP fallback test in XS mode' unless $INC{'B/Hooks/EndOfScope/PP.pm'}; my $w; local $SIG{__WARN__} = sub { $w = $_[0] if $_[0] =~ qr/\QException "bar"/ }; eval q[ sub foo { BEGIN { on_scope_end { die 'Exception "bar"' }; } } ]; like ( $w, qr/scope-end callback raised an exception, which can not be propagated when .+? operates in pure-perl mode/, 'Warning on lost callback exception correctly emited' ); done_testing; B-Hooks-EndOfScope-0.12/t/10-test_without_vm_pure_pp.t000064400000000000000000000022521215633244400225300ustar00rootroot00000000000000use strict; use warnings; use Test::More; use B::Hooks::EndOfScope; plan skip_all => "Tests already executed in pure-perl mode" if $INC{'B/Hooks/EndOfScope/PP.pm'}; use Config; use FindBin qw($Bin); use IPC::Open2 qw(open2); use File::Glob 'bsd_glob'; # in case the user had it set $ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} = ''; # for the $^X-es $ENV{PERL5LIB} = join ($Config{path_sep}, @INC); my $has_dh = eval { require Devel::Hide }; $ENV{DEVEL_HIDE_VERBOSE} = 0 if $has_dh; $ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} = 'PP' unless $has_dh; # rerun the tests under the assumption of no vm at all for my $fn (bsd_glob("$Bin/0*.t")) { note "retesting $fn"; my @cmd = ( $^X, $has_dh ? '-MDevel::Hide=Variable::Magic' : (), $fn ); # this is cheating, and may even hang here and there (testing on windows passed fine) # if it does - will have to fix it somehow (really *REALLY* don't want to pull # in IPC::Cmd just for a fucking test) # the alternative would be to have an ENV check in each test to force a subtest open2(my $out, my $in, @cmd); while (my $ln = <$out>) { print " $ln"; } wait; ok (! $?, "Wstat $? from: @cmd"); } done_testing; B-Hooks-EndOfScope-0.12/t/11-direct_xs.t000064400000000000000000000010251215633244400175140ustar00rootroot00000000000000use strict; use warnings; use Test::More; BEGIN { eval { require B::Hooks::EndOfScope::XS } or plan skip_all => "XS functionality not available"; B::Hooks::EndOfScope::XS->import(); } BEGIN { ok(exists &on_scope_end, 'on_scope_end imported'); is(prototype('on_scope_end'), '&', '.. and has the right prototype'); } our $i; sub foo { BEGIN { on_scope_end { $i = 42 }; }; is($i, 42, 'value still set at runtime'); } BEGIN { is($i, 42, 'value set at compiletime') } foo(); done_testing; B-Hooks-EndOfScope-0.12/t/12-direct_pp.t000064400000000000000000000006341215633244400175070ustar00rootroot00000000000000use strict; use warnings; use Test::More; use B::Hooks::EndOfScope::PP; BEGIN { ok(exists &on_scope_end, 'on_scope_end imported'); is(prototype('on_scope_end'), '&', '.. and has the right prototype'); } our $i; sub foo { BEGIN { on_scope_end { $i = 42 }; }; is($i, 42, 'value still set at runtime'); } BEGIN { is($i, 42, 'value set at compiletime') } foo(); done_testing; B-Hooks-EndOfScope-0.12/t/release-eol.t000064400000000000000000000004761215633244400175170ustar00rootroot00000000000000 BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; use Test::More; eval 'use Test::EOL'; plan skip_all => 'Test::EOL required' if $@; all_perl_files_ok({ trailing_whitespace => 1 }); B-Hooks-EndOfScope-0.12/t/release-no-tabs.t000064400000000000000000000004501215633244400202730ustar00rootroot00000000000000 BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; use Test::More; eval 'use Test::NoTabs'; plan skip_all => 'Test::NoTabs required' if $@; all_perl_files_ok(); B-Hooks-EndOfScope-0.12/t/release-pod-coverage.t000064400000000000000000000007651215633244400213140ustar00rootroot00000000000000#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Pod::Coverage 1.08"; plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@; eval "use Pod::Coverage::TrustPod"; plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" if $@; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); B-Hooks-EndOfScope-0.12/t/release-pod-syntax.t000064400000000000000000000004501215633244400210360ustar00rootroot00000000000000#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok();