From 917c679fc9f3602a0d0916a4d6546abfa81bd730 Mon Sep 17 00:00:00 2001 From: Iain Arnell Date: Tue, 25 Jan 2011 05:05:07 -0500 Subject: [PATCH] initial import --- .gitignore | 1 + perl-Eval-Closure.spec | 67 ++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 69 insertions(+) create mode 100644 perl-Eval-Closure.spec diff --git a/.gitignore b/.gitignore index e69de29..584c2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/Eval-Closure-0.01.tar.gz diff --git a/perl-Eval-Closure.spec b/perl-Eval-Closure.spec new file mode 100644 index 0000000..15c9e4d --- /dev/null +++ b/perl-Eval-Closure.spec @@ -0,0 +1,67 @@ +Name: perl-Eval-Closure +Version: 0.01 +Release: 1%{?dist} +Summary: Safely and cleanly create closures via string eval +License: GPL+ or Artistic +Group: Development/Libraries +URL: http://search.cpan.org/dist/Eval-Closure/ +Source0: http://www.cpan.org/authors/id/D/DO/DOY/Eval-Closure-%{version}.tar.gz +BuildArch: noarch +BuildRequires: perl(ExtUtils::MakeMaker) +BuildRequires: perl(PadWalker) +BuildRequires: perl(Perl::Tidy) +BuildRequires: perl(Scalar::Util) +BuildRequires: perl(Sub::Exporter) +BuildRequires: perl(Test::Fatal) +BuildRequires: perl(Test::More) >= 0.88 +BuildRequires: perl(Test::Output) +BuildRequires: perl(Test::Requires) +BuildRequires: perl(Try::Tiny) +Requires: perl(Perl::Tidy) +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) + +%{?perl_default_filter} + +%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 Eval-Closure-%{version} + +%build +%{__perl} Makefile.PL INSTALLDIRS=vendor +make %{?_smp_mflags} + +%install +make pure_install DESTDIR=%{buildroot} + +find %{buildroot} -type f -name .packlist -exec rm -f {} \; +find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null \; + +%{_fixperms} %{buildroot}/* + +%check +make test + +%files +%defattr(-,root,root,-) +%doc Changes LICENSE README +%{perl_vendorlib}/* +%{_mandir}/man3/* + +%changelog +* Sun Jan 23 2011 Iain Arnell 0.01-1 +- Specfile autogenerated by cpanspec 1.78. diff --git a/sources b/sources index e69de29..cd6ee8c 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +aba60e35313642cf0b7b40c1d94e47e3 Eval-Closure-0.01.tar.gz