3 %bcond_without tests # do not perform "make test"
5 %include /usr/lib/rpm/macros.perl
8 Summary: UNIVERSAL::can - Hack around people calling UNIVERSAL::can() as a function
9 Summary(pl.UTF-8): UNIVERSAL::can - poprawianie ludzi wywołujących UNIVERSAL::can() jako funkcję
10 Name: perl-UNIVERSAL-can
14 License: GPL v1+ or Artistic
15 Group: Development/Languages/Perl
16 Source0: http://www.cpan.org/modules/by-module/UNIVERSAL/%{pdir}-%{pnam}-%{version}.tar.gz
17 # Source0-md5: 4386c4f7479447fc5b51e8c3770cd2f4
18 URL: http://search.cpan.org/dist/UNIVERSAL-can/
19 BuildRequires: perl-Module-Build
20 BuildRequires: perl-devel >= 1:5.8.0
21 BuildRequires: rpm-perlprov >= 4.1-13
23 BuildRequires: perl-Test-Simple >= 0.60
24 BuildRequires: perl-Test-Warn >= 0.08
25 BuildRequires: perl-Tree-DAG_Node
28 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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
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.
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.
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.
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
56 konkretne i odpowiednie zachowanie.
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.
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
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.
75 %setup -q -n %{pdir}-%{pnam}-%{version}
79 destdir=$RPM_BUILD_ROOT \
83 %{?with_tests:./Build test}
86 rm -rf $RPM_BUILD_ROOT
91 rm -rf $RPM_BUILD_ROOT
94 %defattr(644,root,root,755)
96 %{perl_vendorlib}/UNIVERSAL/*.pm