108 lines
3.1 KiB
RPMSpec
108 lines
3.1 KiB
RPMSpec
#
|
|
# spec file for package perl-parent
|
|
#
|
|
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
Name: perl-parent
|
|
Version: 0.238
|
|
Release: 0
|
|
%define cpan_name parent
|
|
Summary: Establish an ISA relationship with base classes at compile time
|
|
License: Artistic-1.0 OR GPL-1.0-or-later
|
|
Group: Development/Libraries/Perl
|
|
Url: https://metacpan.org/release/%{cpan_name}
|
|
Source0: https://cpan.metacpan.org/authors/id/C/CO/CORION/%{cpan_name}-%{version}.tar.gz
|
|
Source1: cpanspec.yml
|
|
Source100: README.md
|
|
BuildArch: noarch
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
BuildRequires: perl
|
|
BuildRequires: perl-macros
|
|
%{perl_requires}
|
|
|
|
%description
|
|
Allows you to both load one or more modules, while setting up inheritance
|
|
from those modules at the same time. Mostly similar in effect to
|
|
|
|
package Baz;
|
|
BEGIN {
|
|
require Foo;
|
|
require Bar;
|
|
push @ISA, qw(Foo Bar);
|
|
}
|
|
|
|
By default, every base class needs to live in a file of its own. If you
|
|
want to have a subclass and its parent class in the same file, you can tell
|
|
'parent' not to load any modules by using the '-norequire' switch:
|
|
|
|
package Foo;
|
|
sub exclaim { "I CAN HAS PERL" }
|
|
|
|
package DoesNotLoadFooBar;
|
|
use parent -norequire, 'Foo', 'Bar';
|
|
# will not go looking for Foo.pm or Bar.pm
|
|
|
|
This is equivalent to the following code:
|
|
|
|
package Foo;
|
|
sub exclaim { "I CAN HAS PERL" }
|
|
|
|
package DoesNotLoadFooBar;
|
|
push @DoesNotLoadFooBar::ISA, 'Foo', 'Bar';
|
|
|
|
This is also helpful for the case where a package lives within a
|
|
differently named file:
|
|
|
|
package MyHash;
|
|
use Tie::Hash;
|
|
use parent -norequire, 'Tie::StdHash';
|
|
|
|
This is equivalent to the following code:
|
|
|
|
package MyHash;
|
|
require Tie::Hash;
|
|
push @ISA, 'Tie::StdHash';
|
|
|
|
If you want to load a subclass from a file that 'require' would not
|
|
consider an eligible filename (that is, it does not end in either '.pm' or
|
|
'.pmc'), use the following code:
|
|
|
|
package MySecondPlugin;
|
|
require './plugins/custom.plugin'; # contains Plugin::Custom
|
|
use parent -norequire, 'Plugin::Custom';
|
|
|
|
%prep
|
|
%setup -q -n %{cpan_name}-%{version}
|
|
find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -name "configure" -print0 | xargs -0 chmod 644
|
|
|
|
%build
|
|
perl Makefile.PL INSTALLDIRS=vendor
|
|
make %{?_smp_mflags}
|
|
|
|
%check
|
|
make test
|
|
|
|
%install
|
|
%perl_make_install
|
|
%perl_process_packlist
|
|
%perl_gen_filelist
|
|
|
|
%files -f %{name}.files
|
|
%defattr(-,root,root,755)
|
|
%doc Changes
|
|
|
|
%changelog
|