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