1
0
perl-Eval-Closure/perl-Eval-Closure.spec
Stephan Kulow a178440e77 - 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

OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Eval-Closure?expand=0&rev=10
2012-05-29 14:44:05 +00:00

83 lines
2.8 KiB
RPMSpec

#
# spec file for package perl-Eval-Closure
#
# Copyright (c) 2012 SUSE LINUX Products 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.08
Release: 0
%define cpan_name Eval-Closure
Summary: Safely and cleanly create closures via string eval
License: GPL-1.0+ or Artistic-1.0
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Eval-Closure/
Source: http://www.cpan.org/authors/id/D/DO/DOY/%{cpan_name}-%{version}.tar.gz
Patch1: perl-Eval-Closure-old_Test-More.patch
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Sub::Exporter)
BuildRequires: perl(Test::Fatal)
BuildRequires: perl(Test::More) >= 0.88
BuildRequires: perl(Test::Requires)
BuildRequires: perl(Try::Tiny)
Requires: perl(Sub::Exporter)
Requires: perl(Try::Tiny)
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 can be quite slow, especially if doing a large
number of evals.
This module attempts to solve both of those problems. It provides an
'eval_closure' function, which evals a string in a clean environment, other
than a fixed list of specified variables. It also caches the result of the
eval, so that doing repeated evals of the same source, even with a
different environment, will be much faster (but note that the description
is part of the string to be evaled, so it must also be the same (or
non-existent) if caching is to work properly).
%prep
%setup -q -n %{cpan_name}-%{version}
%if 0%{?suse_version} < 1210
%patch1 -p1
%endif
%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 weaver.ini
%changelog