Files
perl-autobox-Core/perl-autobox-Core.spec
2025-08-12 18:11:54 +02:00

109 lines
3.4 KiB
RPMSpec

#
# spec file for package perl-autobox-Core
#
# 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 autobox-Core
Name: perl-autobox-Core
Version: 1.330.0
Release: 0
# 1.33 -> normalize -> 1.330.0
%define cpan_version 1.33
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Provide core functions to autoboxed scalars, arrays and hashes
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/S/SW/SWALTERS/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.46
BuildRequires: perl(Test::More) >= 0.88
BuildRequires: perl(Want) >= 0.26
BuildRequires: perl(autobox) >= 2.71
Requires: perl(Test::More) >= 0.88
Requires: perl(Want) >= 0.26
Requires: perl(autobox) >= 2.71
Provides: perl(autobox::Core) = %{version}
Provides: perl(autobox::Core::ARRAY)
Provides: perl(autobox::Core::CODE)
Provides: perl(autobox::Core::HASH)
Provides: perl(autobox::Core::SCALAR)
%undefine __perllib_provides
%{perl_requires}
%description
The autobox module promotes Perl's primitive types (literals (strings and
numbers), scalars, arrays and hashes) into first-class objects. However,
autobox does not provide any methods for these new classes.
autobox::CORE provides a set of methods for these new classes. It includes
almost everything in perlfunc, some things from Scalar::Util and
List::Util, and some Perl 5 versions of methods taken from Perl 6.
With _autobox::Core_ one is able to change this:
print join(" ", reverse(split(" ", $string)));
to this:
use autobox::Core;
$string->split(" ")->reverse->print;
Likewise you can change this:
my $array_ref = [qw(fish dog cat elephant bird)];
push @$array_ref, qw(snake lizard giraffe mouse);
to this:
use autobox::Core;
my $array_ref = [qw(fish dog cat elephant bird)];
$array_ref->push( qw(snake lizard giraffe mouse));
_autobox::Core_ makes it easier to avoid parentheses pile ups and messy
dereferencing syntaxes.
_autobox::Core_ is mostly glue. It presents existing functions with a new
interface, while adding few extra. Most of the methods read like 'sub hex {
CORE::hex($_[0]) }'. In addition to built-ins from perlfunc that operate on
hashes, arrays, scalars, and code references, some Perl 6-ish things have
been included, and some keywords like 'foreach' are represented too.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%changelog