# # spec file for package perl-Eval-Closure # # Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: perl-Eval-Closure Version: 0.14 Release: 1.9 %define cpan_name Eval-Closure Summary: Safely and Cleanly Create Closures Via String Eval License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Eval-Closure/ Source0: http://www.cpan.org/authors/id/D/DO/DOY/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Test::Fatal) BuildRequires: perl(Test::More) >= 0.88 BuildRequires: perl(Test::Requires) Recommends: perl(Devel::LexAlias) >= 0.05 Recommends: perl(Perl::Tidy) %{perl_requires} %description String eval is often used for dynamic code generation. For instance, '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 'eval_closure' function, which evals a string in a clean environment, other than a fixed list of specified variables. Compilation errors are rethrown automatically. %prep %setup -q -n %{cpan_name}-%{version} %build %{__perl} Makefile.PL INSTALLDIRS=vendor %{__make} %{?_smp_mflags} %check %{__make} test %install %perl_make_install %perl_process_packlist %perl_gen_filelist %files -f %{name}.files %defattr(-,root,root,755) %doc Changes LICENSE README %changelog * Tue May 31 2016 coolo@suse.com - updated to 0.14 see /usr/share/doc/packages/perl-Eval-Closure/Changes 0.14 2016-05-29 - a couple minor optimizations (dolmen, #8) * Wed May 13 2015 coolo@suse.com - updated to 0.13 see /usr/share/doc/packages/perl-Eval-Closure/Changes 0.13 2015-05-12 - one more fix for blead (eserte, jplesnik, #6) * Tue Apr 14 2015 coolo@suse.com - updated to 0.12 see /usr/share/doc/packages/perl-Eval-Closure/Changes 0.12 2015-01-17 - fix tests under blead (sprout, #4) * Wed Jul 31 2013 coolo@suse.com - updated to 0.11 - 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) * Sat Jul 27 2013 coolo@suse.com - updated to 0.10 - fix pod links - support lexical subs on 5.18+ * Thu Mar 21 2013 lars@linux-schulserver.de - remove perl-Eval-Closure-old_Test-More.patch - handle the problem with old distributions in %%%%prep now * Tue May 29 2012 coolo@suse.com - updated to 0.08 - 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. - 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 * Fri Nov 18 2011 coolo@suse.com - update to 0.06 - The dumped source from setting $ENV{EVAL_CLOSURE_PRINT_SOURCE} didn't show the captured variable creation properly. (Dave Rolsky) * Sat Jun 4 2011 lars@linux-schulserver.de - fix build on distributions with old Test::More module ( perl-Eval-Closure-old_Test-More.patch ) * Wed May 4 2011 coolo@opensuse.org - updated to 0.05 - make sure Perl::Tidy doesn't look at @ARGV (rafl) - stop using Memoize, it apparently doesn't work properly under mod_perl in some situations (mateu) * Fri Apr 15 2011 pascal.bleser@opensuse.org - initial version (0.03)