]>
Commit | Line | Data |
---|---|---|
a4b61761 | 1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | # | |
5 | %include /usr/lib/rpm/macros.perl | |
6 | %define pdir UNIVERSAL | |
7 | %define pnam can | |
8 | Summary: UNIVERSAL::can - Hack around people calling UNIVERSAL::can() as a function | |
2d0649e7 | 9 | Summary(pl.UTF-8): UNIVERSAL::can - poprawianie ludzi wywołujących UNIVERSAL::can() jako funkcję |
a4b61761 | 10 | Name: perl-UNIVERSAL-can |
56c26517 | 11 | Version: 1.12 |
6754234b | 12 | Release: 2 |
a4b61761 | 13 | # same as perl |
14 | License: GPL v1+ or Artistic | |
15 | Group: Development/Languages/Perl | |
39f0e101 | 16 | Source0: http://www.cpan.org/modules/by-module/UNIVERSAL/%{pdir}-%{pnam}-%{version}.tar.gz |
56c26517 | 17 | # Source0-md5: 4386c4f7479447fc5b51e8c3770cd2f4 |
887374e8 | 18 | URL: http://search.cpan.org/dist/UNIVERSAL-can/ |
39f0e101 | 19 | BuildRequires: perl-Module-Build |
a4b61761 | 20 | BuildRequires: perl-devel >= 1:5.8.0 |
21 | BuildRequires: rpm-perlprov >= 4.1-13 | |
22 | %if %{with tests} | |
23 | BuildRequires: perl-Test-Simple >= 0.60 | |
24 | BuildRequires: perl-Test-Warn >= 0.08 | |
25 | BuildRequires: perl-Tree-DAG_Node | |
26 | %endif | |
27 | BuildArch: noarch | |
28 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
29 | ||
30 | %description | |
887374e8 JB |
31 | The UNIVERSAL class provides a few default methods so that all objects |
32 | can use them. Object orientation allows programmers to override these | |
33 | methods in subclasses to provide more specific and appropriate | |
34 | behavior. | |
a4b61761 | 35 | |
887374e8 JB |
36 | Some authors call methods in the UNIVERSAL class on potential |
37 | invocants as functions, bypassing any possible overriding. This is | |
38 | wrong and you should not do it. Unfortunately, not everyone heeds this | |
39 | warning and their bad code can break your good code. | |
a4b61761 | 40 | |
887374e8 JB |
41 | Fortunately, this module replaces UNIVERSAL::can() with a method that |
42 | checks to see if the first argument is a valid invocant (whether an | |
43 | object - a blessed referent - or the name of a class). If so, and if | |
44 | the invocant's class has its own can() method, it calls that as a | |
45 | method. Otherwise, everything works as you might expect. | |
a4b61761 | 46 | |
887374e8 JB |
47 | If someone attempts to call UNIVERSAL::can() as a function, this |
48 | module will emit a lexical warning (see perllexwarn) to that effect. | |
49 | You can disable it with no warnings; or no warnings 'UNIVERSAL::isa';, | |
50 | but don't do that; fix the code instead. | |
a4b61761 | 51 | |
733441df JR |
52 | %description -l pl.UTF-8 |
53 | Klasa UNIVERSAL udostępnia kilka domyślnych metod, które mogą być | |
54 | używane przez wszystkie obiekty. Zorientowanie obiektowe pozwala | |
55 | programistom przykryć te metody w podklasach, aby zapewnić bardziej | |
887374e8 JB |
56 | konkretne i odpowiednie zachowanie. |
57 | ||
733441df JR |
58 | Niektórzy autorzy wywołują metody w klasie UNIVERSAL na potencjalnych |
59 | wywołujących jako funkcje, pomijając jakiekolwiek przykrywanie. Jest | |
60 | to niedobre i nie należy tego robić. Niestety nie każdy zwraca uwagę | |
61 | na to ostrzeżenie i jego zły kod może zepsuć inny dobry kod. | |
887374e8 | 62 | |
733441df JR |
63 | Na szczęście ten moduł zastępuje UNIVERSAL::can() metodą sprawdzającą |
64 | czy pierwszy argument jest poprawnym wywołującym (obiektem - | |
65 | pobłogosławioną referencją - albo nazwą klasy). Jeśli tak, a klasa | |
66 | wywołującego ma własną metodę can(), wywołuje ją jako metodę. W | |
67 | przeciwnym wypadku wszystko działa tak, jak można by się tego | |
68 | spodziewać. | |
887374e8 | 69 | |
733441df JR |
70 | Jeśli ktoś próbuje wywołać UNIVERSAL::can() jako funkcję, ten moduł |
71 | wygeneruje ostrzeżenie słowne (perllexwarn). Można wyłączyć je - ale | |
72 | nie należy tego robić, zamiast tego lepiej poprawić kod. | |
a4b61761 | 73 | |
74 | %prep | |
75 | %setup -q -n %{pdir}-%{pnam}-%{version} | |
76 | ||
77 | %build | |
78 | %{__perl} Build.PL \ | |
79 | destdir=$RPM_BUILD_ROOT \ | |
80 | installdirs=vendor | |
81 | ./Build | |
82 | ||
83 | %{?with_tests:./Build test} | |
84 | ||
85 | %install | |
86 | rm -rf $RPM_BUILD_ROOT | |
87 | ||
88 | ./Build install | |
89 | ||
90 | %clean | |
91 | rm -rf $RPM_BUILD_ROOT | |
92 | ||
93 | %files | |
94 | %defattr(644,root,root,755) | |
95 | %doc Changes README | |
96 | %{perl_vendorlib}/UNIVERSAL/*.pm | |
97 | %{_mandir}/man3/* |