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