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