]> git.pld-linux.org Git - SPECS.git/blob - perl-Sub-Assert.spec
SPECS updated Sun 1 Aug 15:50:02 CEST 2021
[SPECS.git] / perl-Sub-Assert.spec
1 #
2 # Conditional build:
3 %bcond_without  tests           # do not perform "make test"
4 #
5 %define pdir    Sub
6 %define pnam    Assert
7 Summary:        Sub::Assert - Design-by-contract like pre- and postconditions, etc.
8 Summary(pl.UTF-8):      Sub::Assert - warunki przed i po wywołaniu w stylu projektowania przez kontrakt
9 Name:           perl-Sub-Assert
10 Version:        1.23
11 Release:        0.1
12 # same as perl
13 License:        GPL v1+ or Artistic
14 Group:          Development/Languages/Perl
15 Source0:        http://www.cpan.org/modules/by-module/Sub/%{pdir}-%{pnam}-%{version}.tar.gz
16 # Source0-md5:  e90f4c875a3e4a3d91579165c14337e1
17 URL:            http://search.cpan.org/dist/Sub-Assert/
18 BuildRequires:  perl-devel >= 1:5.8.0
19 BuildRequires:  rpm-perlprov >= 4.1-13
20 %if %{with tests}
21 %endif
22 BuildArch:      noarch
23 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24
25 %description
26 The Sub::Assert module aims at providing design-by-contract like
27 subroutine pre- and postconditions. Furthermore, it allows restricting
28 the subroutine's calling context.
29
30 There's one big gotcha with this: It's slow. For every call to
31 subroutines you use assert() with, you pay for the error checking
32 with an extra subroutine call, some memory and some additional code
33 that's executed.
34
35 Fortunately, there's a workaround for mature software
36 which does not require you to edit a lot of your code. Instead of
37 use()ing Sub::Assert, you simply use Sub::Assert::Nothing and leave
38 the assertions intact. While you still suffer the calls to assert()
39 once, you won't pay the run-time penalty usually associated with
40 subroutine pre- and postconditions. Of course, you lose the benefits,
41 too, but as stated previously, this is a workaround in case you
42 want the verification at development time, but prefer speed in
43 production without refactoring your code.
44
45 %description -l pl.UTF-8
46 Celem modułu Sub::Assert jest zapewnienie warunków sprawdzanych przed
47 i po wywołaniu procedur, w stylu projektowania przez kontrakt
48 (design-by-contract). Ponadto umożliwia on restrykcje dla kontekstu
49 wywoływania procedur.
50
51 Jest jeden duży problem: jest wolny. Dla każdego wywołania procedury
52 z assert() płaci się za sprawdzenie błędu dodatkowy wywołaniem
53 procedury, pewną ilością pamięci i wykonaniem dodatkowego kodu.
54
55 Na szczęście jest obejście tego problemu dla dojrzałego oprogramowania
56 nie wymagające modyfikowania dużej ilości kodu. Zamiast użycia (use)
57 Sub::Assert można użyć Sub::Assert::Nothing i pozostawić instrukcje
58 zapewnień. O ile nadal będą wywoływane funkcje assert(), nie będzie
59 już narzutu sprawdzania warunków przed i po wywołaniach. Oczywiście
60 traci się wtedy korzyści, ale, jak napisano wcześniej, jest to
61 obejście w przypadku kiedy chcemy kontroli w czasie rozwijania
62 oprogramowania, a preferujemy szybkość w produkcji.
63
64 %prep
65 %setup -q -n %{pdir}-%{pnam}-%{version}
66
67 %build
68 %{__perl} Makefile.PL \
69         INSTALLDIRS=vendor
70 %{__make}
71
72 %{?with_tests:%{__make} test}
73
74 %install
75 rm -rf $RPM_BUILD_ROOT
76
77 %{__make} install \
78         DESTDIR=$RPM_BUILD_ROOT
79
80 %clean
81 rm -rf $RPM_BUILD_ROOT
82
83 %files
84 %defattr(644,root,root,755)
85 %doc Changes README
86 %{perl_vendorlib}/Sub/*.pm
87 %dir %{perl_vendorlib}/Sub/Assert
88 %{perl_vendorlib}/Sub/Assert/*.pm
89 %{_mandir}/man3/*
This page took 0.646573 seconds and 3 git commands to generate.