summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-05-12 04:54:59 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-05-12 04:54:59 +0000
commitcf3c05406f7cde406764915682e4bf5db73b1bdd (patch)
tree5050bd2311e38dc2b691a80ef187d2759a47e37b
downloadEval-Closure-tarball-master.tar.gz
-rw-r--r--Changes60
-rw-r--r--LICENSE379
-rw-r--r--MANIFEST25
-rw-r--r--META.json565
-rw-r--r--META.yml411
-rw-r--r--Makefile.PL74
-rw-r--r--README15
-rw-r--r--dist.ini26
-rw-r--r--lib/Eval/Closure.pm371
-rw-r--r--t/00-compile.t50
-rw-r--r--t/basic.t48
-rw-r--r--t/canonicalize-source.t31
-rw-r--r--t/close-over-nonref.t20
-rw-r--r--t/close-over.t72
-rw-r--r--t/compiling-package.t44
-rw-r--r--t/debugger.t23
-rw-r--r--t/description.t53
-rw-r--r--t/errors.t67
-rw-r--r--t/lexical-subs.t26
-rw-r--r--t/memoize.t108
-rw-r--r--xt/release/eol.t8
-rw-r--r--xt/release/no-tabs.t25
-rw-r--r--xt/release/pod-coverage.t7
-rw-r--r--xt/release/pod-syntax.t6
24 files changed, 2514 insertions, 0 deletions
diff --git a/Changes b/Changes
new file mode 100644
index 0000000..8748d6d
--- /dev/null
+++ b/Changes
@@ -0,0 +1,60 @@
+Revision history for Eval-Closure
+
+0.13 2015-05-12
+ - one more fix for blead (eserte, jplesnik, #6)
+
+0.12 2015-01-17
+ - fix tests under blead (sprout, #4)
+
+0.11 2013-07-30
+ - add "alias => 1" option for making closure variables actually alias the
+ closed over variables (so the variable referenced in the environment
+ hashref will actually be updated by changes made in the closure). (Toby
+ Inkster, #3)
+
+0.10 2013-07-10
+ - fix pod links
+
+0.09 2013-07-10
+ - support lexical subs on 5.18+
+
+0.08 2012-02-09
+ - Remove a double layer of string eval that was introduced in 0.07 as an
+ intermediate step in figuring out the unique package thing - it's not
+ necessary with the final implementation, and just makes things slower
+ and hides errors.
+
+0.07 2012-02-03
+ - the given source is now evaled in a unique package for every
+ eval_closure call (it used to always be evaled in the Eval::Closure
+ package, which was especially buggy). this is to avoid issues where one
+ eval_closure modifies the global environment (by, say, importing a
+ function), which could mess up a later call. unfortunately, this means
+ that the memoization stuff no longer works, since it will result in
+ memoized results using the original package, which defeats the purpose.
+ i'm open to suggestions on how to safely reenable it though.
+
+ - clean up a few stray lexicals we were still closing over in the eval
+
+0.06 2011-06-05
+ - The dumped source from setting $ENV{EVAL_CLOSURE_PRINT_SOURCE} didn't
+ show the captured variable creation properly. (Dave Rolsky)
+
+0.05 2011-04-25
+ - make sure Perl::Tidy doesn't look at @ARGV (rafl)
+
+0.04 2011-04-15
+ - stop using Memoize, it apparently doesn't work properly under mod_perl
+ in some situations (mateu)
+
+0.03 2011-03-02
+ - don't add #line directives when the debugger is active (alh)
+
+0.02 2011-01-26
+ - add terse_error option for throwing only the actual compilation error
+ (Shawn M Moore)
+ - allow also specifying the line number for error reporting
+ (Shawn M Moore)
+
+0.01 2010-11-14
+ - Initial release
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0c4f671
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,379 @@
+This software is copyright (c) 2015 by Jesse Luehrs.
+
+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) 2015 by Jesse Luehrs.
+
+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) 2015 by Jesse Luehrs.
+
+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 --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..62a3953
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,25 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.032.
+Changes
+LICENSE
+MANIFEST
+META.json
+META.yml
+Makefile.PL
+README
+dist.ini
+lib/Eval/Closure.pm
+t/00-compile.t
+t/basic.t
+t/canonicalize-source.t
+t/close-over-nonref.t
+t/close-over.t
+t/compiling-package.t
+t/debugger.t
+t/description.t
+t/errors.t
+t/lexical-subs.t
+t/memoize.t
+xt/release/eol.t
+xt/release/no-tabs.t
+xt/release/pod-coverage.t
+xt/release/pod-syntax.t
diff --git a/META.json b/META.json
new file mode 100644
index 0000000..f231214
--- /dev/null
+++ b/META.json
@@ -0,0 +1,565 @@
+{
+ "abstract" : "safely and cleanly create closures via string eval",
+ "author" : [
+ "Jesse Luehrs <doy@tozt.net>"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 5.032, CPAN::Meta::Converter version 2.143240",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Eval-Closure",
+ "prereqs" : {
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
+ "develop" : {
+ "requires" : {
+ "Pod::Coverage::TrustPod" : "0",
+ "Test::EOL" : "0",
+ "Test::More" : "0",
+ "Test::NoTabs" : "0",
+ "Test::Output" : "0",
+ "Test::Pod" : "1.41",
+ "Test::Pod::Coverage" : "1.08"
+ }
+ },
+ "runtime" : {
+ "recommends" : {
+ "Devel::LexAlias" : "0.05",
+ "Perl::Tidy" : "0"
+ },
+ "requires" : {
+ "Carp" : "0",
+ "Exporter" : "0",
+ "Scalar::Util" : "0",
+ "Try::Tiny" : "0",
+ "constant" : "0",
+ "overload" : "0",
+ "strict" : "0",
+ "warnings" : "0"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "B" : "0",
+ "File::Spec" : "0",
+ "IO::Handle" : "0",
+ "IPC::Open3" : "0",
+ "Test::Fatal" : "0",
+ "Test::More" : "0.88",
+ "Test::Requires" : "0"
+ }
+ }
+ },
+ "provides" : {
+ "Eval::Closure" : {
+ "file" : "lib/Eval/Closure.pm",
+ "version" : "0.13"
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "web" : "https://github.com/doy/eval-closure/issues"
+ },
+ "homepage" : "http://metacpan.org/release/Eval-Closure",
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/doy/eval-closure.git",
+ "web" : "https://github.com/doy/eval-closure"
+ }
+ },
+ "version" : "0.13",
+ "x_Dist_Zilla" : {
+ "perl" : {
+ "version" : "5.020000"
+ },
+ "plugins" : [
+ {
+ "class" : "Dist::Zilla::Plugin::Prereqs",
+ "config" : {
+ "Dist::Zilla::Plugin::Prereqs" : {
+ "phase" : "test",
+ "type" : "requires"
+ }
+ },
+ "name" : "@DOY/TestMoreDoneTesting",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::GatherDir",
+ "config" : {
+ "Dist::Zilla::Plugin::GatherDir" : {
+ "exclude_filename" : [],
+ "exclude_match" : [],
+ "follow_symlinks" : "0",
+ "include_dotfiles" : "0",
+ "prefix" : "",
+ "prune_directory" : [],
+ "root" : "."
+ }
+ },
+ "name" : "@DOY/GatherDir",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PruneCruft",
+ "name" : "@DOY/PruneCruft",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ManifestSkip",
+ "name" : "@DOY/ManifestSkip",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaYAML",
+ "name" : "@DOY/MetaYAML",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::License",
+ "name" : "@DOY/License",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Readme",
+ "name" : "@DOY/Readme",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::RunExtraTests",
+ "config" : {
+ "Dist::Zilla::Role::TestRunner" : {
+ "default_jobs" : 1
+ }
+ },
+ "name" : "@DOY/RunExtraTests",
+ "version" : "0.022"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ExecDir",
+ "name" : "@DOY/ExecDir",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ShareDir",
+ "name" : "@DOY/ShareDir",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MakeMaker",
+ "config" : {
+ "Dist::Zilla::Role::TestRunner" : {
+ "default_jobs" : 1
+ }
+ },
+ "name" : "@DOY/MakeMaker",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Manifest",
+ "name" : "@DOY/Manifest",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::TestRelease",
+ "name" : "@DOY/TestRelease",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ConfirmRelease",
+ "name" : "@DOY/ConfirmRelease",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaConfig",
+ "name" : "@DOY/MetaConfig",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaJSON",
+ "name" : "@DOY/MetaJSON",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::NextRelease",
+ "name" : "@DOY/NextRelease",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::CheckChangesHasContent",
+ "name" : "@DOY/CheckChangesHasContent",
+ "version" : "0.006"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PkgVersion",
+ "name" : "@DOY/PkgVersion",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Authority",
+ "name" : "@DOY/Authority",
+ "version" : "1.009"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PodCoverageTests",
+ "name" : "@DOY/PodCoverageTests",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
+ "name" : "@DOY/PodSyntaxTests",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Test::NoTabs",
+ "config" : {
+ "Dist::Zilla::Plugin::Test::NoTabs" : {
+ "finder" : [
+ ":InstallModules",
+ ":ExecFiles",
+ ":TestFiles"
+ ]
+ }
+ },
+ "name" : "@DOY/Test::NoTabs",
+ "version" : "0.08"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::EOLTests",
+ "config" : {
+ "Dist::Zilla::Plugin::Test::EOL" : {
+ "filename" : "xt/release/eol.t"
+ }
+ },
+ "name" : "@DOY/EOLTests",
+ "version" : "0.16"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Test::Compile",
+ "config" : {
+ "Dist::Zilla::Plugin::Test::Compile" : {
+ "filename" : "t/00-compile.t",
+ "module_finder" : [
+ ":InstallModules"
+ ],
+ "script_finder" : [
+ ":ExecFiles"
+ ]
+ }
+ },
+ "name" : "@DOY/Test::Compile",
+ "version" : "2.043"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Metadata",
+ "name" : "@DOY/Metadata",
+ "version" : "3.03"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaResources",
+ "name" : "@DOY/MetaResources",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Check",
+ "config" : {
+ "Dist::Zilla::Plugin::Git::Check" : {
+ "untracked_files" : "die"
+ },
+ "Dist::Zilla::Role::Git::DirtyFiles" : {
+ "allow_dirty" : [],
+ "allow_dirty_match" : [],
+ "changelog" : "Changes"
+ },
+ "Dist::Zilla::Role::Git::Repo" : {
+ "repo_root" : "."
+ }
+ },
+ "name" : "@DOY/Git::Check",
+ "version" : "2.023"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Commit",
+ "config" : {
+ "Dist::Zilla::Plugin::Git::Commit" : {
+ "add_files_in" : [],
+ "commit_msg" : "changelog",
+ "time_zone" : "local"
+ },
+ "Dist::Zilla::Role::Git::DirtyFiles" : {
+ "allow_dirty" : [
+ "dist.ini",
+ "Changes"
+ ],
+ "allow_dirty_match" : [],
+ "changelog" : "Changes"
+ },
+ "Dist::Zilla::Role::Git::Repo" : {
+ "repo_root" : "."
+ }
+ },
+ "name" : "@DOY/Git::Commit",
+ "version" : "2.023"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::Tag",
+ "config" : {
+ "Dist::Zilla::Plugin::Git::Tag" : {
+ "branch" : null,
+ "signed" : 0,
+ "tag" : "0.13",
+ "tag_format" : "%v",
+ "tag_message" : "",
+ "time_zone" : "local"
+ },
+ "Dist::Zilla::Role::Git::Repo" : {
+ "repo_root" : "."
+ }
+ },
+ "name" : "@DOY/Git::Tag",
+ "version" : "2.023"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Git::NextVersion",
+ "config" : {
+ "Dist::Zilla::Plugin::Git::NextVersion" : {
+ "first_version" : "0.01",
+ "version_by_branch" : "0",
+ "version_regexp" : "(?^:^(\\d+\\.\\d+)$)"
+ },
+ "Dist::Zilla::Role::Git::Repo" : {
+ "repo_root" : "."
+ }
+ },
+ "name" : "@DOY/Git::NextVersion",
+ "version" : "2.023"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ContributorsFromGit",
+ "name" : "@DOY/ContributorsFromGit",
+ "version" : "0.014"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::MetaProvides::Package",
+ "config" : {
+ "Dist::Zilla::Plugin::MetaProvides::Package" : {
+ "finder_objects" : [
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : "@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
+ "version" : "5.032"
+ }
+ ]
+ },
+ "Dist::Zilla::Role::MetaProvider::Provider" : {
+ "inherit_missing" : "1",
+ "inherit_version" : "1",
+ "meta_noindex" : "1"
+ }
+ },
+ "name" : "@DOY/MetaProvides::Package",
+ "version" : "2.000002"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::PodWeaver",
+ "config" : {
+ "Dist::Zilla::Plugin::PodWeaver" : {
+ "finder" : [
+ ":InstallModules",
+ ":ExecFiles"
+ ],
+ "plugins" : [
+ {
+ "class" : "Pod::Weaver::Plugin::EnsurePod5",
+ "name" : "@CorePrep/EnsurePod5",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Plugin::H1Nester",
+ "name" : "@CorePrep/H1Nester",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Plugin::SingleEncoding",
+ "name" : "@Default/SingleEncoding",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Name",
+ "name" : "@Default/Name",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Version",
+ "name" : "@Default/Version",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Region",
+ "name" : "@Default/prelude",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Generic",
+ "name" : "SYNOPSIS",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Generic",
+ "name" : "DESCRIPTION",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Generic",
+ "name" : "OVERVIEW",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Collect",
+ "name" : "ATTRIBUTES",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Collect",
+ "name" : "METHODS",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Collect",
+ "name" : "FUNCTIONS",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Leftovers",
+ "name" : "@Default/Leftovers",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Region",
+ "name" : "@Default/postlude",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Authors",
+ "name" : "@Default/Authors",
+ "version" : "4.012"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Legal",
+ "name" : "@Default/Legal",
+ "version" : "4.012"
+ }
+ ]
+ }
+ },
+ "name" : "@DOY/PodWeaver",
+ "version" : "4.005"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::UploadToCPAN",
+ "name" : "@DOY/UploadToCPAN",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::AutoPrereqs",
+ "name" : "AutoPrereqs",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Prereqs",
+ "config" : {
+ "Dist::Zilla::Plugin::Prereqs" : {
+ "phase" : "runtime",
+ "type" : "recommends"
+ }
+ },
+ "name" : "RuntimeRecommends",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Prereqs",
+ "config" : {
+ "Dist::Zilla::Plugin::Prereqs" : {
+ "phase" : "develop",
+ "type" : "requires"
+ }
+ },
+ "name" : "DevelopRequires",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ContributorsFromGit",
+ "name" : "ContributorsFromGit",
+ "version" : "0.014"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":InstallModules",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":IncModules",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":TestFiles",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":ExecFiles",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":ShareFiles",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":MainModule",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":AllFiles",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":NoFiles",
+ "version" : "5.032"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : "@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM",
+ "version" : "5.032"
+ }
+ ],
+ "zilla" : {
+ "class" : "Dist::Zilla::Dist::Builder",
+ "config" : {
+ "is_trial" : "0"
+ },
+ "version" : "5.032"
+ }
+ },
+ "x_authority" : "cpan:DOY",
+ "x_contributors" : [
+ "Dave Rolsky <autarch@urth.org>",
+ "Shawn M Moore <sartak@bestpractical.com>",
+ "Toby Inkster <mail@tobyinkster.co.uk>"
+ ]
+}
+
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..a3202f8
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,411 @@
+---
+abstract: 'safely and cleanly create closures via string eval'
+author:
+ - 'Jesse Luehrs <doy@tozt.net>'
+build_requires:
+ B: '0'
+ File::Spec: '0'
+ IO::Handle: '0'
+ IPC::Open3: '0'
+ Test::Fatal: '0'
+ Test::More: '0.88'
+ Test::Requires: '0'
+configure_requires:
+ ExtUtils::MakeMaker: '0'
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 5.032, CPAN::Meta::Converter version 2.143240'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: '1.4'
+name: Eval-Closure
+provides:
+ Eval::Closure:
+ file: lib/Eval/Closure.pm
+ version: '0.13'
+recommends:
+ Devel::LexAlias: '0.05'
+ Perl::Tidy: '0'
+requires:
+ Carp: '0'
+ Exporter: '0'
+ Scalar::Util: '0'
+ Try::Tiny: '0'
+ constant: '0'
+ overload: '0'
+ strict: '0'
+ warnings: '0'
+resources:
+ bugtracker: https://github.com/doy/eval-closure/issues
+ homepage: http://metacpan.org/release/Eval-Closure
+ repository: git://github.com/doy/eval-closure.git
+version: '0.13'
+x_Dist_Zilla:
+ perl:
+ version: '5.020000'
+ plugins:
+ -
+ class: Dist::Zilla::Plugin::Prereqs
+ config:
+ Dist::Zilla::Plugin::Prereqs:
+ phase: test
+ type: requires
+ name: '@DOY/TestMoreDoneTesting'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::GatherDir
+ config:
+ Dist::Zilla::Plugin::GatherDir:
+ exclude_filename: []
+ exclude_match: []
+ follow_symlinks: '0'
+ include_dotfiles: '0'
+ prefix: ''
+ prune_directory: []
+ root: .
+ name: '@DOY/GatherDir'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::PruneCruft
+ name: '@DOY/PruneCruft'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::ManifestSkip
+ name: '@DOY/ManifestSkip'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::MetaYAML
+ name: '@DOY/MetaYAML'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::License
+ name: '@DOY/License'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::Readme
+ name: '@DOY/Readme'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::RunExtraTests
+ config:
+ Dist::Zilla::Role::TestRunner:
+ default_jobs: 1
+ name: '@DOY/RunExtraTests'
+ version: '0.022'
+ -
+ class: Dist::Zilla::Plugin::ExecDir
+ name: '@DOY/ExecDir'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::ShareDir
+ name: '@DOY/ShareDir'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::MakeMaker
+ config:
+ Dist::Zilla::Role::TestRunner:
+ default_jobs: 1
+ name: '@DOY/MakeMaker'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::Manifest
+ name: '@DOY/Manifest'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::TestRelease
+ name: '@DOY/TestRelease'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::ConfirmRelease
+ name: '@DOY/ConfirmRelease'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::MetaConfig
+ name: '@DOY/MetaConfig'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::MetaJSON
+ name: '@DOY/MetaJSON'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::NextRelease
+ name: '@DOY/NextRelease'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::CheckChangesHasContent
+ name: '@DOY/CheckChangesHasContent'
+ version: '0.006'
+ -
+ class: Dist::Zilla::Plugin::PkgVersion
+ name: '@DOY/PkgVersion'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::Authority
+ name: '@DOY/Authority'
+ version: '1.009'
+ -
+ class: Dist::Zilla::Plugin::PodCoverageTests
+ name: '@DOY/PodCoverageTests'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::PodSyntaxTests
+ name: '@DOY/PodSyntaxTests'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::Test::NoTabs
+ config:
+ Dist::Zilla::Plugin::Test::NoTabs:
+ finder:
+ - ':InstallModules'
+ - ':ExecFiles'
+ - ':TestFiles'
+ name: '@DOY/Test::NoTabs'
+ version: '0.08'
+ -
+ class: Dist::Zilla::Plugin::EOLTests
+ config:
+ Dist::Zilla::Plugin::Test::EOL:
+ filename: xt/release/eol.t
+ name: '@DOY/EOLTests'
+ version: '0.16'
+ -
+ class: Dist::Zilla::Plugin::Test::Compile
+ config:
+ Dist::Zilla::Plugin::Test::Compile:
+ filename: t/00-compile.t
+ module_finder:
+ - ':InstallModules'
+ script_finder:
+ - ':ExecFiles'
+ name: '@DOY/Test::Compile'
+ version: '2.043'
+ -
+ class: Dist::Zilla::Plugin::Metadata
+ name: '@DOY/Metadata'
+ version: '3.03'
+ -
+ class: Dist::Zilla::Plugin::MetaResources
+ name: '@DOY/MetaResources'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::Git::Check
+ config:
+ Dist::Zilla::Plugin::Git::Check:
+ untracked_files: die
+ Dist::Zilla::Role::Git::DirtyFiles:
+ allow_dirty: []
+ allow_dirty_match: []
+ changelog: Changes
+ Dist::Zilla::Role::Git::Repo:
+ repo_root: .
+ name: '@DOY/Git::Check'
+ version: '2.023'
+ -
+ class: Dist::Zilla::Plugin::Git::Commit
+ config:
+ Dist::Zilla::Plugin::Git::Commit:
+ add_files_in: []
+ commit_msg: changelog
+ time_zone: local
+ Dist::Zilla::Role::Git::DirtyFiles:
+ allow_dirty:
+ - dist.ini
+ - Changes
+ allow_dirty_match: []
+ changelog: Changes
+ Dist::Zilla::Role::Git::Repo:
+ repo_root: .
+ name: '@DOY/Git::Commit'
+ version: '2.023'
+ -
+ class: Dist::Zilla::Plugin::Git::Tag
+ config:
+ Dist::Zilla::Plugin::Git::Tag:
+ branch: ~
+ signed: 0
+ tag: '0.13'
+ tag_format: '%v'
+ tag_message: ''
+ time_zone: local
+ Dist::Zilla::Role::Git::Repo:
+ repo_root: .
+ name: '@DOY/Git::Tag'
+ version: '2.023'
+ -
+ class: Dist::Zilla::Plugin::Git::NextVersion
+ config:
+ Dist::Zilla::Plugin::Git::NextVersion:
+ first_version: '0.01'
+ version_by_branch: '0'
+ version_regexp: (?^:^(\d+\.\d+)$)
+ Dist::Zilla::Role::Git::Repo:
+ repo_root: .
+ name: '@DOY/Git::NextVersion'
+ version: '2.023'
+ -
+ class: Dist::Zilla::Plugin::ContributorsFromGit
+ name: '@DOY/ContributorsFromGit'
+ version: '0.014'
+ -
+ class: Dist::Zilla::Plugin::MetaProvides::Package
+ config:
+ Dist::Zilla::Plugin::MetaProvides::Package:
+ finder_objects:
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: '@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
+ version: '5.032'
+ Dist::Zilla::Role::MetaProvider::Provider:
+ inherit_missing: '1'
+ inherit_version: '1'
+ meta_noindex: '1'
+ name: '@DOY/MetaProvides::Package'
+ version: '2.000002'
+ -
+ class: Dist::Zilla::Plugin::PodWeaver
+ config:
+ Dist::Zilla::Plugin::PodWeaver:
+ finder:
+ - ':InstallModules'
+ - ':ExecFiles'
+ plugins:
+ -
+ class: Pod::Weaver::Plugin::EnsurePod5
+ name: '@CorePrep/EnsurePod5'
+ version: '4.012'
+ -
+ class: Pod::Weaver::Plugin::H1Nester
+ name: '@CorePrep/H1Nester'
+ version: '4.012'
+ -
+ class: Pod::Weaver::Plugin::SingleEncoding
+ name: '@Default/SingleEncoding'
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Name
+ name: '@Default/Name'
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Version
+ name: '@Default/Version'
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Region
+ name: '@Default/prelude'
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Generic
+ name: SYNOPSIS
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Generic
+ name: DESCRIPTION
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Generic
+ name: OVERVIEW
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Collect
+ name: ATTRIBUTES
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Collect
+ name: METHODS
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Collect
+ name: FUNCTIONS
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Leftovers
+ name: '@Default/Leftovers'
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Region
+ name: '@Default/postlude'
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Authors
+ name: '@Default/Authors'
+ version: '4.012'
+ -
+ class: Pod::Weaver::Section::Legal
+ name: '@Default/Legal'
+ version: '4.012'
+ name: '@DOY/PodWeaver'
+ version: '4.005'
+ -
+ class: Dist::Zilla::Plugin::UploadToCPAN
+ name: '@DOY/UploadToCPAN'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::AutoPrereqs
+ name: AutoPrereqs
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::Prereqs
+ config:
+ Dist::Zilla::Plugin::Prereqs:
+ phase: runtime
+ type: recommends
+ name: RuntimeRecommends
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::Prereqs
+ config:
+ Dist::Zilla::Plugin::Prereqs:
+ phase: develop
+ type: requires
+ name: DevelopRequires
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::ContributorsFromGit
+ name: ContributorsFromGit
+ version: '0.014'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':InstallModules'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':IncModules'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':TestFiles'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':ExecFiles'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':ShareFiles'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':MainModule'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':AllFiles'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':NoFiles'
+ version: '5.032'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: '@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM'
+ version: '5.032'
+ zilla:
+ class: Dist::Zilla::Dist::Builder
+ config:
+ is_trial: '0'
+ version: '5.032'
+x_authority: cpan:DOY
+x_contributors:
+ - 'Dave Rolsky <autarch@urth.org>'
+ - 'Shawn M Moore <sartak@bestpractical.com>'
+ - 'Toby Inkster <mail@tobyinkster.co.uk>'
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..a29f082
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,74 @@
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.032.
+use strict;
+use warnings;
+
+
+
+use ExtUtils::MakeMaker;
+
+my %WriteMakefileArgs = (
+ "ABSTRACT" => "safely and cleanly create closures via string eval",
+ "AUTHOR" => "Jesse Luehrs <doy\@tozt.net>",
+ "CONFIGURE_REQUIRES" => {
+ "ExtUtils::MakeMaker" => 0
+ },
+ "DISTNAME" => "Eval-Closure",
+ "EXE_FILES" => [],
+ "LICENSE" => "perl",
+ "NAME" => "Eval::Closure",
+ "PREREQ_PM" => {
+ "Carp" => 0,
+ "Exporter" => 0,
+ "Scalar::Util" => 0,
+ "Try::Tiny" => 0,
+ "constant" => 0,
+ "overload" => 0,
+ "strict" => 0,
+ "warnings" => 0
+ },
+ "TEST_REQUIRES" => {
+ "B" => 0,
+ "File::Spec" => 0,
+ "IO::Handle" => 0,
+ "IPC::Open3" => 0,
+ "Test::Fatal" => 0,
+ "Test::More" => "0.88",
+ "Test::Requires" => 0
+ },
+ "VERSION" => "0.13",
+ "test" => {
+ "TESTS" => "t/*.t"
+ }
+);
+
+
+my %FallbackPrereqs = (
+ "B" => 0,
+ "Carp" => 0,
+ "Exporter" => 0,
+ "ExtUtils::MakeMaker" => 0,
+ "File::Spec" => 0,
+ "IO::Handle" => 0,
+ "IPC::Open3" => 0,
+ "Scalar::Util" => 0,
+ "Test::Fatal" => 0,
+ "Test::More" => "0.88",
+ "Test::Requires" => 0,
+ "Try::Tiny" => 0,
+ "constant" => 0,
+ "overload" => 0,
+ "strict" => 0,
+ "warnings" => 0
+);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+ delete $WriteMakefileArgs{TEST_REQUIRES};
+ delete $WriteMakefileArgs{BUILD_REQUIRES};
+ $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
+}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
diff --git a/README b/README
new file mode 100644
index 0000000..ff61acf
--- /dev/null
+++ b/README
@@ -0,0 +1,15 @@
+
+
+This archive contains the distribution Eval-Closure,
+version 0.13:
+
+ safely and cleanly create closures via string eval
+
+This software is copyright (c) 2015 by Jesse Luehrs.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+
+This README file was generated by Dist::Zilla::Plugin::Readme v5.032.
+
diff --git a/dist.ini b/dist.ini
new file mode 100644
index 0000000..52b5d04
--- /dev/null
+++ b/dist.ini
@@ -0,0 +1,26 @@
+name = Eval-Closure
+author = Jesse Luehrs <doy@tozt.net>
+license = Perl_5
+copyright_holder = Jesse Luehrs
+
+[@DOY]
+:version = 0.15
+dist = Eval-Closure
+repository = github
+bugtracker_web = https://github.com/doy/eval-closure/issues
+bugtracker_mailto =
+Authority_authority_style = pkg
+
+[AutoPrereqs]
+skip = ^Perl::Tidy$
+skip = ^perl$
+skip = ^Devel::LexAlias$
+
+[Prereqs / RuntimeRecommends]
+Perl::Tidy = 0
+Devel::LexAlias = 0.05
+
+[Prereqs / DevelopRequires]
+Test::Output = 0
+
+[ContributorsFromGit]
diff --git a/lib/Eval/Closure.pm b/lib/Eval/Closure.pm
new file mode 100644
index 0000000..292c453
--- /dev/null
+++ b/lib/Eval/Closure.pm
@@ -0,0 +1,371 @@
+package Eval::Closure;
+BEGIN {
+ $Eval::Closure::AUTHORITY = 'cpan:DOY';
+}
+$Eval::Closure::VERSION = '0.13';
+use strict;
+use warnings;
+# ABSTRACT: safely and cleanly create closures via string eval
+
+use Exporter 'import';
+@Eval::Closure::EXPORT = @Eval::Closure::EXPORT_OK = 'eval_closure';
+
+use Carp;
+use overload ();
+use Scalar::Util qw(reftype);
+use Try::Tiny;
+
+use constant HAS_LEXICAL_SUBS => $] >= 5.018;
+
+
+
+sub eval_closure {
+ my (%args) = @_;
+
+ # default to copying environment
+ $args{alias} = 0 if !exists $args{alias};
+
+ $args{source} = _canonicalize_source($args{source});
+ _validate_env($args{environment} ||= {});
+
+ $args{source} = _line_directive(@args{qw(line description)})
+ . $args{source}
+ if defined $args{description} && !($^P & 0x10);
+
+ my ($code, $e) = _clean_eval_closure(@args{qw(source environment alias)});
+
+ if (!$code) {
+ if ($args{terse_error}) {
+ die "$e\n";
+ }
+ else {
+ croak("Failed to compile source: $e\n\nsource:\n$args{source}")
+ }
+ }
+
+ return $code;
+}
+
+sub _canonicalize_source {
+ my ($source) = @_;
+
+ if (defined($source)) {
+ if (ref($source)) {
+ if (reftype($source) eq 'ARRAY'
+ || overload::Method($source, '@{}')) {
+ return join "\n", @$source;
+ }
+ elsif (overload::Method($source, '""')) {
+ return "$source";
+ }
+ else {
+ croak("The 'source' parameter to eval_closure must be a "
+ . "string or array reference");
+ }
+ }
+ else {
+ return $source;
+ }
+ }
+ else {
+ croak("The 'source' parameter to eval_closure is required");
+ }
+}
+
+sub _validate_env {
+ my ($env) = @_;
+
+ croak("The 'environment' parameter must be a hashref")
+ unless reftype($env) eq 'HASH';
+
+ for my $var (keys %$env) {
+ if (HAS_LEXICAL_SUBS) {
+ croak("Environment key '$var' should start with \@, \%, \$, or \&")
+ unless $var =~ /^([\@\%\$\&])/;
+ }
+ else {
+ croak("Environment key '$var' should start with \@, \%, or \$")
+ unless $var =~ /^([\@\%\$])/;
+ }
+ croak("Environment values must be references, not $env->{$var}")
+ unless ref($env->{$var});
+ }
+}
+
+sub _line_directive {
+ my ($line, $description) = @_;
+
+ $line = 1 unless defined($line);
+
+ return qq{#line $line "$description"\n};
+}
+
+sub _clean_eval_closure {
+ my ($source, $captures, $alias) = @_;
+
+ my @capture_keys = sort keys %$captures;
+
+ if ($ENV{EVAL_CLOSURE_PRINT_SOURCE}) {
+ _dump_source(_make_compiler_source($source, $alias, @capture_keys));
+ }
+
+ my ($compiler, $e) = _make_compiler($source, $alias, @capture_keys);
+ my $code;
+ if (defined $compiler) {
+ $code = $compiler->(@$captures{@capture_keys});
+ }
+
+ if (defined($code) && (!ref($code) || ref($code) ne 'CODE')) {
+ $e = "The 'source' parameter must return a subroutine reference, "
+ . "not $code";
+ undef $code;
+ }
+
+ if ($alias) {
+ require Devel::LexAlias;
+ Devel::LexAlias::lexalias($code, $_, $captures->{$_})
+ for grep !/^\&/, keys %$captures;
+ }
+
+ return ($code, $e);
+}
+
+sub _make_compiler {
+ my $source = _make_compiler_source(@_);
+
+ return @{ _clean_eval($source) };
+}
+
+sub _clean_eval {
+ local $@;
+ local $SIG{__DIE__};
+ my $compiler = eval $_[0];
+ my $e = $@;
+ [ $compiler, $e ];
+}
+
+$Eval::Closure::SANDBOX_ID = 0;
+
+sub _make_compiler_source {
+ my ($source, $alias, @capture_keys) = @_;
+ $Eval::Closure::SANDBOX_ID++;
+ my $i = 0;
+ return join "\n", (
+ "package Eval::Closure::Sandbox_$Eval::Closure::SANDBOX_ID;",
+ 'sub {',
+ (map { _make_lexical_assignment($_, $i++, $alias) } @capture_keys),
+ $source,
+ '}',
+ );
+}
+
+sub _make_lexical_assignment {
+ my ($key, $index, $alias) = @_;
+ my $sigil = substr($key, 0, 1);
+ my $name = substr($key, 1);
+ if (HAS_LEXICAL_SUBS && $sigil eq '&') {
+ my $tmpname = '$__' . $name . '__' . $index;
+ return 'use feature "lexical_subs"; '
+ . 'no warnings "experimental::lexical_subs"; '
+ . 'my ' . $tmpname . ' = $_[' . $index . ']; '
+ . 'my sub ' . $name . ' { goto ' . $tmpname . ' }';
+ }
+ if ($alias) {
+ return 'my ' . $key . ';';
+ }
+ else {
+ return 'my ' . $key . ' = ' . $sigil . '{$_[' . $index . ']};';
+ }
+}
+
+sub _dump_source {
+ my ($source) = @_;
+
+ my $output;
+ if (try { require Perl::Tidy }) {
+ Perl::Tidy::perltidy(
+ source => \$source,
+ destination => \$output,
+ argv => [],
+ );
+ }
+ else {
+ $output = $source;
+ }
+
+ warn "$output\n";
+}
+
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Eval::Closure - safely and cleanly create closures via string eval
+
+=head1 VERSION
+
+version 0.13
+
+=head1 SYNOPSIS
+
+ use Eval::Closure;
+
+ my $code = eval_closure(
+ source => 'sub { $foo++ }',
+ environment => {
+ '$foo' => \1,
+ },
+ );
+
+ warn $code->(); # 1
+ warn $code->(); # 2
+
+ my $code2 = eval_closure(
+ source => 'sub { $code->() }',
+ ); # dies, $code isn't in scope
+
+=head1 DESCRIPTION
+
+String eval is often used for dynamic code generation. For instance, C<Moose>
+uses it heavily, to generate inlined versions of accessors and constructors,
+which speeds code up at runtime by a significant amount. String eval is not
+without its issues however - it's difficult to control the scope it's used in
+(which determines which variables are in scope inside the eval), and it's easy
+to miss compilation errors, since eval catches them and sticks them in $@
+instead.
+
+This module attempts to solve these problems. It provides an C<eval_closure>
+function, which evals a string in a clean environment, other than a fixed list
+of specified variables. Compilation errors are rethrown automatically.
+
+=head1 FUNCTIONS
+
+=head2 eval_closure(%args)
+
+This function provides the main functionality of this module. It is exported by
+default. It takes a hash of parameters, with these keys being valid:
+
+=over 4
+
+=item source
+
+The string to be evaled. It should end by returning a code reference. It can
+access any variable declared in the C<environment> parameter (and only those
+variables). It can be either a string, or an arrayref of lines (which will be
+joined with newlines to produce the string).
+
+=item environment
+
+The environment to provide to the eval. This should be a hashref, mapping
+variable names (including sigils) to references of the appropriate type. For
+instance, a valid value for environment would be C<< { '@foo' => [] } >> (which
+would allow the generated function to use an array named C<@foo>). Generally,
+this is used to allow the generated function to access externally defined
+variables (so you would pass in a reference to a variable that already exists).
+
+In perl 5.18 and greater, the environment hash can contain variables with a
+sigil of C<&>. This will create a lexical sub in the evaluated code (see
+L<feature/The 'lexical_subs' feature>). Using a C<&> sigil on perl versions
+before lexical subs were available will throw an error.
+
+=item alias
+
+If set to true, the coderef returned closes over the variables referenced in
+the environment hashref. (This feature requires L<Devel::LexAlias>.) If set to
+false, the coderef closes over a I<< shallow copy >> of the variables.
+
+If this argument is omitted, Eval::Closure will currently assume false, but
+this assumption may change in a future version.
+
+=item description
+
+This lets you provide a bit more information in backtraces. Normally, when a
+function that was generated through string eval is called, that stack frame
+will show up as "(eval n)", where 'n' is a sequential identifier for every
+string eval that has happened so far in the program. Passing a C<description>
+parameter lets you override that to something more useful (for instance,
+L<Moose> overrides the description for accessors to something like "accessor
+foo at MyClass.pm, line 123").
+
+=item line
+
+This lets you override the particular line number that appears in backtraces,
+much like the C<description> option. The default is 1.
+
+=item terse_error
+
+Normally, this function appends the source code that failed to compile, and
+prepends some explanatory text. Setting this option to true suppresses that
+behavior so you get only the compilation error that Perl actually reported.
+
+=back
+
+=head1 BUGS
+
+No known bugs.
+
+Please report any bugs to GitHub Issues at
+L<https://github.com/doy/eval-closure/issues>.
+
+=head1 SEE ALSO
+
+=over 4
+
+=item * L<Class::MOP::Method::Accessor>
+
+This module is a factoring out of code that used to live here
+
+=back
+
+=head1 SUPPORT
+
+You can find this documentation for this module with the perldoc command.
+
+ perldoc Eval::Closure
+
+You can also look for information at:
+
+=over 4
+
+=item * MetaCPAN
+
+L<https://metacpan.org/release/Eval-Closure>
+
+=item * Github
+
+L<https://github.com/doy/eval-closure>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Eval-Closure>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/Eval-Closure>
+
+=back
+
+=head1 NOTES
+
+Based on code from L<Class::MOP::Method::Accessor>, by Stevan Little and the
+Moose Cabal.
+
+=head1 AUTHOR
+
+Jesse Luehrs <doy@tozt.net>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2015 by Jesse Luehrs.
+
+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
diff --git a/t/00-compile.t b/t/00-compile.t
new file mode 100644
index 0000000..58d98f8
--- /dev/null
+++ b/t/00-compile.t
@@ -0,0 +1,50 @@
+use 5.006;
+use strict;
+use warnings;
+
+# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.043
+
+use Test::More tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
+
+
+
+my @module_files = (
+ 'Eval/Closure.pm'
+);
+
+
+
+# no fake home requested
+
+my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
+
+use File::Spec;
+use IPC::Open3;
+use IO::Handle;
+
+open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
+
+my @warnings;
+for my $lib (@module_files)
+{
+ # see L<perlfaq8/How can I capture STDERR from an external command?>
+ my $stderr = IO::Handle->new;
+
+ my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
+ binmode $stderr, ':crlf' if $^O eq 'MSWin32';
+ my @_warnings = <$stderr>;
+ waitpid($pid, 0);
+ is($?, 0, "$lib loaded ok");
+
+ if (@_warnings)
+ {
+ warn @_warnings;
+ push @warnings, @_warnings;
+ }
+}
+
+
+
+is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING};
+
+
diff --git a/t/basic.t b/t/basic.t
new file mode 100644
index 0000000..3a318ac
--- /dev/null
+++ b/t/basic.t
@@ -0,0 +1,48 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+
+use Eval::Closure;
+
+{
+ my $code = eval_closure(
+ source => 'sub { die "called\n" }',
+ );
+ ok($code, "got something");
+
+ like(exception { $code->() }, qr/^called$/, "got the right thing");
+}
+
+{
+ my $foo = [];
+
+ my $code = eval_closure(
+ source => 'sub { push @$bar, @_ }',
+ environment => {
+ '$bar' => \$foo,
+ },
+ );
+ ok($code, "got something");
+
+ $code->(1);
+
+ is_deeply($foo, [1], "got the right thing");
+}
+
+{
+ my $foo = [1, 2, 3];
+
+ my $code = eval_closure(
+ # not sure if strict leaking into evals is intended, i think i remember
+ # it being changed in newer perls
+ source => 'do { no strict; sub { $foo } }',
+ );
+
+ ok($code, "got something");
+
+ ok(!$code->(), "environment is clean");
+}
+
+done_testing;
diff --git a/t/canonicalize-source.t b/t/canonicalize-source.t
new file mode 100644
index 0000000..79c08a3
--- /dev/null
+++ b/t/canonicalize-source.t
@@ -0,0 +1,31 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Eval::Closure;
+
+{
+ my $code = eval_closure(
+ source =>
+ 'sub {'
+ . '"foo"'
+ . '}',
+ );
+ ok($code, "got code");
+ is($code->(), "foo", "got the right code");
+}
+
+{
+ my $code = eval_closure(
+ source => [
+ 'sub {',
+ '"foo"',
+ '}',
+ ],
+ );
+ ok($code, "got code");
+ is($code->(), "foo", "got the right code");
+}
+
+done_testing;
diff --git a/t/close-over-nonref.t b/t/close-over-nonref.t
new file mode 100644
index 0000000..62096c3
--- /dev/null
+++ b/t/close-over-nonref.t
@@ -0,0 +1,20 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Requires { "Devel::LexAlias" => "0.05" };
+
+use Eval::Closure;
+
+my $number = 40;
+my $closure = eval_closure(
+ source => 'sub { $xxx += 2 }',
+ environment => { '$xxx' => \$number },
+ alias => 1,
+);
+
+$closure->();
+
+is($number, 42);
+
+done_testing;
diff --git a/t/close-over.t b/t/close-over.t
new file mode 100644
index 0000000..905a3f7
--- /dev/null
+++ b/t/close-over.t
@@ -0,0 +1,72 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+
+use B;
+use Eval::Closure;
+
+use Test::Requires 'PadWalker';
+
+{
+ my $foo = [];
+ my $env = { '$foo' => \$foo };
+
+ my $code = eval_closure(
+ source => 'sub { push @$foo, @_ }',
+ environment => $env,
+ );
+ is_deeply(scalar(PadWalker::closed_over($code)), $env,
+ "closed over the right things");
+}
+
+{
+ my $foo = {};
+ my $bar = [];
+ my $env = { '$foo' => \$bar, '$bar' => \$foo };
+
+ my $code = eval_closure(
+ source => 'sub { push @$foo, @_; $bar->{foo} = \@_ }',
+ environment => $env,
+ );
+ is_deeply(scalar(PadWalker::closed_over($code)), $env,
+ "closed over the right things");
+}
+
+{
+ # i feel dirty
+ my $c = eval_closure(source => 'sub { }');
+ my $b = B::svref_2object($c);
+ my @scopes;
+ while ($b->isa('B::CV')) {
+ push @scopes, $b;
+ $b = $b->OUTSIDE;
+ }
+ my @visible_in_outer_scope
+ = grep { defined && length && $_ ne '&' }
+ map { $_->PV }
+ grep { $_->can('PV') }
+ map { $_->PADLIST->ARRAYelt(0)->ARRAY }
+ @scopes;
+
+ # test to ensure we don't inadvertently screw up this test by rearranging
+ # code. if the scope that encloses the eval ends up not declaring $e, then
+ # change this test.
+ ok(scalar(grep { $_ eq '$e' } @visible_in_outer_scope),
+ "visible list is sane");
+
+ for my $outer_scope_pad_entry (@visible_in_outer_scope) {
+ like(
+ exception {
+ eval_closure(
+ source => "sub { $outer_scope_pad_entry }",
+ );
+ },
+ qr/Global symbol "\Q$outer_scope_pad_entry/,
+ "we don't close over $outer_scope_pad_entry"
+ );
+ }
+}
+
+done_testing;
diff --git a/t/compiling-package.t b/t/compiling-package.t
new file mode 100644
index 0000000..fa27d0e
--- /dev/null
+++ b/t/compiling-package.t
@@ -0,0 +1,44 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Eval::Closure;
+
+{
+ my $code = eval_closure(
+ source => 'no strict "refs"; sub { keys %{__PACKAGE__ . "::"} }',
+ );
+
+ # defining the sub { } creates __ANON__, calling 'no strict' creates BEGIN
+ my @stash_keys = grep { $_ ne '__ANON__' && $_ ne 'BEGIN' } $code->();
+
+ is_deeply([@stash_keys], [], "compiled in an empty package");
+}
+
+{
+ # the more common case where you'd run into this is imported subs
+ # for instance, Bread::Board::as vs Moose::Util::TypeConstraints::as
+ my $c1 = eval_closure(
+ source => 'no strict "vars"; sub { ++$foo }',
+ );
+ my $c2 = eval_closure(
+ source => 'no strict "vars"; sub { --$foo }',
+ );
+ is($c1->(), 1);
+ is($c1->(), 2);
+ is($c2->(), -1);
+ is($c2->(), -2);
+}
+
+{
+ my $source = 'no strict "vars"; sub { ++$foo }';
+ my $c1 = eval_closure(source => $source);
+ my $c2 = eval_closure(source => $source);
+ is($c1->(), 1);
+ is($c1->(), 2);
+ is($c2->(), 1);
+ is($c2->(), 2);
+}
+
+done_testing;
diff --git a/t/debugger.t b/t/debugger.t
new file mode 100644
index 0000000..7b97272
--- /dev/null
+++ b/t/debugger.t
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+
+BEGIN { $^P |= 0x210 } # PERLDBf_SUBLINE
+
+use Eval::Closure;
+
+unlike(
+ exception {
+ eval_closure(
+ source => 'sub { $bar }',
+ description => 'foo',
+ )
+ },
+ qr/#line/,
+ "#line directive isn't added when debugger is active"
+);
+
+
+done_testing;
diff --git a/t/description.t b/t/description.t
new file mode 100644
index 0000000..269b530
--- /dev/null
+++ b/t/description.t
@@ -0,0 +1,53 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+
+use Eval::Closure;
+
+my $source = <<'SOURCE';
+sub {
+ Carp::confess("foo")
+}
+SOURCE
+
+{
+ my $code = eval_closure(
+ source => $source,
+ );
+
+ like(
+ exception { $code->() },
+ qr/^foo at \(eval \d+\) line \d+/,
+ "no location info if context isn't passed"
+ );
+}
+
+{
+ my $code = eval_closure(
+ source => $source,
+ description => 'accessor foo (defined at Class.pm line 282)',
+ );
+
+ like(
+ exception { $code->() },
+ qr/^foo at accessor foo \(defined at Class\.pm line 282\) line 2/,
+ "description is set"
+ );
+}
+
+{
+ my $code = eval_closure(
+ source => $source,
+ line => 100,
+ description => 'accessor foo (defined at Class.pm line 282)',
+ );
+
+ like(
+ exception { $code->() },
+ qr/^foo at accessor foo \(defined at Class\.pm line 282\) line 101/,
+ "description is set"
+ );
+}
+done_testing;
diff --git a/t/errors.t b/t/errors.t
new file mode 100644
index 0000000..3f0cde2
--- /dev/null
+++ b/t/errors.t
@@ -0,0 +1,67 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+
+use Eval::Closure;
+
+like(
+ exception { eval_closure() },
+ qr/'source'.*required/,
+ "error when source isn't declared"
+);
+
+like(
+ exception { eval_closure(source => {}) },
+ qr/'source'.*string or array/,
+ "error when source isn't string or array"
+);
+
+like(
+ exception { eval_closure(source => 1) },
+ qr/'source'.*return.*sub/,
+ "error when source doesn't return a sub"
+);
+
+like(
+ exception {
+ eval_closure(
+ source => 'sub { }',
+ environment => { 'foo' => \1 },
+ )
+ },
+ qr/should start with \@, \%,/,
+ "error from malformed env"
+);
+
+like(
+ exception {
+ eval_closure(
+ source => 'sub { }',
+ environment => { '$foo' => 1 },
+ )
+ },
+ qr/must be.*reference/,
+ "error from non-ref value"
+);
+
+like(
+ exception { eval_closure(source => '$1++') },
+ qr/Modification of a read-only value/,
+ "gives us compile errors properly"
+);
+
+like(
+ exception { eval_closure(source => 'sub { $x }') },
+ qr/sub \s* { \s* \$x \s* }/x,
+ "without terse_error, includes the source code"
+);
+
+unlike(
+ exception { eval_closure(source => 'sub { $x }', terse_error => 1) },
+ qr/sub \s* { \s* \$x \s* }/x,
+ "with terse_error, does not include the source code"
+);
+
+done_testing;
diff --git a/t/lexical-subs.t b/t/lexical-subs.t
new file mode 100644
index 0000000..db425c9
--- /dev/null
+++ b/t/lexical-subs.t
@@ -0,0 +1,26 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN {
+ if (!eval { require 5.018; 1 }) {
+ plan skip_all => "this test requires 5.18";
+ }
+}
+use 5.018;
+
+use Eval::Closure;
+
+my $sub = eval_closure(
+ source => 'sub { foo() }',
+ environment => {
+ '&foo' => sub { state $i++ },
+ }
+);
+
+is($sub->(), 0);
+is($sub->(), 1);
+is($sub->(), 2);
+
+done_testing;
diff --git a/t/memoize.t b/t/memoize.t
new file mode 100644
index 0000000..b012596
--- /dev/null
+++ b/t/memoize.t
@@ -0,0 +1,108 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+use Test::Requires 'Test::Output';
+
+use Eval::Closure;
+
+# XXX this whole test isn't very useful anymore, since we no longer do
+# memoization. it would be nice to bring it back at some point though, if there
+# was a way to do this without breaking the other tests
+
+plan skip_all => "disabling this test for now";
+
+{
+ my $source = 'BEGIN { warn "foo\n" } sub { $foo * 2 }';
+
+ my $code;
+ my $bar = 15;
+ stderr_is {
+ $code = eval_closure(
+ source => $source,
+ environment => {
+ '$foo' => \$bar,
+ },
+ );
+ } "foo\n", "BEGIN was run";
+
+ is($code->(), 30, "got the right sub");
+
+ my $code2;
+ my $baz = 8;
+ stderr_is {
+ $code2 = eval_closure(
+ source => $source,
+ environment => {
+ '$foo' => \$baz,
+ },
+ );
+ } '', "BEGIN was not run twice";
+
+ is($code2->(), 16, "got the right sub");
+}
+
+{
+ my $source = 'BEGIN { warn "bar\n" } sub { $bar * 2 }';
+
+ my $code;
+ my $foo = 60;
+ stderr_is {
+ $code = eval_closure(
+ source => $source,
+ environment => {
+ '$bar' => \$foo,
+ },
+ description => 'foo',
+ );
+ } "bar\n", "BEGIN was run";
+
+ is($code->(), 120, "got the right sub");
+
+ my $code2;
+ my $baz = 23;
+ { local $TODO = "description breaks memoization";
+ stderr_is {
+ $code2 = eval_closure(
+ source => $source,
+ environment => {
+ '$bar' => \$baz,
+ },
+ description => 'baz',
+ );
+ } '', "BEGIN was not run twice";
+ }
+
+ is($code2->(), 46, "got the right sub");
+}
+
+{
+ my $source = 'BEGIN { warn "baz\n" } sub { Carp::confess "baz" }';
+
+ my $code;
+ stderr_is {
+ $code = eval_closure(
+ source => $source,
+ description => 'first',
+ );
+ } "baz\n", "BEGIN was run";
+
+ like(exception { $code->() }, qr/baz at first line 1/,
+ "got the right description");
+
+ my $code2;
+ { local $TODO = "description breaks memoization";
+ stderr_is {
+ $code2 = eval_closure(
+ source => $source,
+ description => 'second',
+ );
+ } '', "BEGIN was not run twice";
+ }
+
+ like(exception { $code2->() }, qr/baz at second line 1/,
+ "got the right description");
+}
+
+done_testing;
diff --git a/xt/release/eol.t b/xt/release/eol.t
new file mode 100644
index 0000000..24b0b33
--- /dev/null
+++ b/xt/release/eol.t
@@ -0,0 +1,8 @@
+use strict;
+use warnings;
+use Test::More;
+
+# generated by Dist::Zilla::Plugin::Test::EOL 0.16
+use Test::EOL;
+
+all_perl_files_ok({ trailing_whitespace => 1 });
diff --git a/xt/release/no-tabs.t b/xt/release/no-tabs.t
new file mode 100644
index 0000000..230607d
--- /dev/null
+++ b/xt/release/no-tabs.t
@@ -0,0 +1,25 @@
+use strict;
+use warnings;
+
+# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.08
+
+use Test::More 0.88;
+use Test::NoTabs;
+
+my @files = (
+ 'lib/Eval/Closure.pm',
+ 't/00-compile.t',
+ 't/basic.t',
+ 't/canonicalize-source.t',
+ 't/close-over-nonref.t',
+ 't/close-over.t',
+ 't/compiling-package.t',
+ 't/debugger.t',
+ 't/description.t',
+ 't/errors.t',
+ 't/lexical-subs.t',
+ 't/memoize.t'
+);
+
+notabs_ok($_) foreach @files;
+done_testing;
diff --git a/xt/release/pod-coverage.t b/xt/release/pod-coverage.t
new file mode 100644
index 0000000..66b3b64
--- /dev/null
+++ b/xt/release/pod-coverage.t
@@ -0,0 +1,7 @@
+#!perl
+# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
+
+use Test::Pod::Coverage 1.08;
+use Pod::Coverage::TrustPod;
+
+all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
diff --git a/xt/release/pod-syntax.t b/xt/release/pod-syntax.t
new file mode 100644
index 0000000..f0468f1
--- /dev/null
+++ b/xt/release/pod-syntax.t
@@ -0,0 +1,6 @@
+#!perl
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
+use Test::More;
+use Test::Pod 1.41;
+
+all_pod_files_ok();