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