3 %bcond_without tests # do not perform "make test"
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
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
23 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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.
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
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.
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
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.
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.
65 %setup -q -n %{pdir}-%{pnam}-%{version}
68 %{__perl} Makefile.PL \
72 %{?with_tests:%{__make} test}
75 rm -rf $RPM_BUILD_ROOT
78 DESTDIR=$RPM_BUILD_ROOT
81 rm -rf $RPM_BUILD_ROOT
84 %defattr(644,root,root,755)
86 %{perl_vendorlib}/Sub/*.pm
87 %dir %{perl_vendorlib}/Sub/Assert
88 %{perl_vendorlib}/Sub/Assert/*.pm