Files
perl-Class-Light/perl-Class-Light.spec
2025-08-12 18:12:25 +02:00

81 lines
3.1 KiB
RPMSpec

#
# spec file for package perl-Class-Light
#
# Copyright (c) 2024 SUSE LLC
#
# 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/
#
%define cpan_name Class-Light
Name: perl-Class-Light
Version: 0.10.30
Release: 0
%define cpan_version 0.01003
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Provides cascading object initialization and autovivified accessors and [cut]
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/D/DA/DAVAZ/%{cpan_name}-%{cpan_version}.tar.gz
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Module::Build)
Provides: perl(Class::Light) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
Subclasses are not to define a class method named "new", instead they
should define the private instance method named "_init" which does object
initialization. 'new' will invoke '_init' from each superclass in the
object's class hierarchy including of course the object's class itself.
'_init' should not bless or return $self as this is handled by 'new'.
Installs default accessor and mutator methods for public instance members.
Public members are those hash keys that don't start with an underscore.
Accessor and mutator methods can be invoked as:
'$obj->getAttribute' or '$obj->get_attribute' or '$obj->get_Attribute'
All forms of invocation will search for the member named "attribute" in the
object and, if found, AUTOLOAD will install a method of the corresponding
name in the package that '$obj''s class belongs to. Note that this imposes
the restriction on inheriting classes that if they want automatically
defined accessor and mutator methods for their public members, those
members' identifiers must start with a lowercase letter. Also note that
access to private members will not be given to AUTOLOAD, so for example a
method invocation such as '$obj->get__attribute' will not install and
execute an accessor for the private member "_attribute". If a method
already exists for one of the three forms shown above then that method is
executed. For example, if a user invokes a non-existant '$obj->get_foo' but
'$obj->getFoo' does exist, then '$obj->getFoo' is invoked.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%build
perl Build.PL --installdirs=vendor
./Build build --flags=%{?_smp_mflags}
%check
./Build test
%install
./Build install --destdir=%{buildroot} --create_packlist=0
%perl_gen_filelist
%files -f %{name}.files
%changelog