]>
Commit | Line | Data |
---|---|---|
738de7b1 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | # | |
5 | %define pdir Eval | |
6 | %define pnam Closure | |
738de7b1 JB |
7 | Summary: Eval::Closure - safely and cleanly create closures via string eval |
8 | Summary(pl.UTF-8): Eval::Closure - bezpieczne i czyste tworzenie dopełnień poprzez eval łańcucha | |
9 | Name: perl-Eval-Closure | |
db269e32 | 10 | Version: 0.14 |
43d631b2 | 11 | Release: 1 |
738de7b1 JB |
12 | # same as perl |
13 | License: GPL v1+ or Artistic | |
14 | Group: Development/Languages/Perl | |
15 | Source0: http://www.cpan.org/modules/by-authors/id/D/DO/DOY/Eval-Closure-%{version}.tar.gz | |
db269e32 | 16 | # Source0-md5: ceeb1fc579ac9af981fa6b600538c285 |
98390540 | 17 | URL: https://metacpan.org/release/Eval-Closure |
738de7b1 JB |
18 | BuildRequires: perl-ExtUtils-MakeMaker >= 6.30 |
19 | BuildRequires: perl-devel >= 1:5.8.0 | |
20 | BuildRequires: rpm-perlprov >= 4.1-13 | |
98390540 | 21 | BuildRequires: rpmbuild(macros) >= 1.745 |
738de7b1 | 22 | %if %{with tests} |
738de7b1 JB |
23 | BuildRequires: perl-Test-Fatal |
24 | BuildRequires: perl-Test-Requires | |
25 | BuildRequires: perl-Test-Simple >= 0.88 | |
26 | %endif | |
27 | BuildArch: noarch | |
28 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
29 | ||
30 | %description | |
31 | String eval is often used for dynamic code generation. For instance, | |
32 | Moose uses it heavily, to generate inlined versions of accessors and | |
33 | constructors, which speeds code up at runtime by a significant amount. | |
34 | String eval is not without its issues however - it's difficult to | |
35 | control the scope it's used in (which determines which variables are | |
36 | in scope inside the eval), and it's easy to miss compilation errors, | |
37 | since eval catches them and sticks them in $@ instead. | |
38 | ||
39 | This module attempts to solve these problems. It provides an | |
40 | eval_closure function, which evals a string in a clean environment, | |
41 | other than a fixed list of specified variables. Compilation errors are | |
42 | rethrown automatically. | |
43 | ||
44 | %description -l pl.UTF-8 | |
45 | Instrukcja eval na łańcuchu często służy do dynamicznego generowania | |
46 | kodu. Np. Moose wykorzystuje ją intensywnie do generowania | |
47 | wewnętrznych wersji akcesorów i konstruktorów, co znacząco przyspiesza | |
48 | kod w trakcie działania. Użycie eval na łańcuchu nie jest jednak | |
49 | pozbawione wad - jest trudno kontrolować zakres, w jakim jest użyte | |
50 | (co określa, które zmienne są w tym zakresie) i łatwo przeoczyć błędy | |
51 | kompilacji, jako że eval przechwytuje je i umieszcza w $@. | |
52 | ||
53 | Niniejszy moduł próbuje rozwiązać te problemy. Dostarcza funkcję | |
54 | eval_closure, która wylicza łańcuch w czystym środowisku, innym niż | |
55 | stała lista określonych zmiennych. Błędy kompilacji są automatyczne | |
56 | wyrzucane ponownie. | |
57 | ||
58 | %prep | |
59 | %setup -q -n %{pdir}-%{pnam}-%{version} | |
60 | ||
61 | %build | |
62 | %{__perl} Makefile.PL \ | |
63 | INSTALLDIRS=vendor | |
64 | %{__make} | |
65 | ||
66 | %{?with_tests:%{__make} test} | |
67 | ||
68 | %install | |
69 | rm -rf $RPM_BUILD_ROOT | |
70 | ||
71 | %{__make} pure_install \ | |
72 | DESTDIR=$RPM_BUILD_ROOT | |
73 | ||
74 | %clean | |
75 | rm -rf $RPM_BUILD_ROOT | |
76 | ||
77 | %files | |
78 | %defattr(644,root,root,755) | |
79 | %doc Changes README | |
80 | %{perl_vendorlib}/Eval/Closure.pm | |
81 | %{_mandir}/man3/Eval::Closure.3pm* |