Files
perl-Data-Rmap/perl-Data-Rmap.spec
2025-08-12 18:13:07 +02:00

86 lines
3.0 KiB
RPMSpec

#
# spec file for package perl-Data-Rmap
#
# 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 Data-Rmap
Name: perl-Data-Rmap
Version: 0.650.0
Release: 0
# 0.65 -> normalize -> 0.650.0
%define cpan_version 0.65
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Recursive map, apply a block to a data structure
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/B/BO/BOWMANBS/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Module::Build) >= 0.42
BuildRequires: perl(Test::Exception)
Requires: perl(Test::Exception)
Provides: perl(Data::Rmap) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
rmap BLOCK LIST
Recursively evaluate a BLOCK over a list of data structures (locally
setting $_ to each element) and return the list composed of the results of
such evaluations. $_ can be used to modify the elements.
Data::Rmap currently traverses HASH, ARRAY, SCALAR and GLOB reference types
and ignores others. Depending on which rmap_* wrapper is used, the BLOCK is
called for only scalar values, arrays, hashes, references, all elements or
a customizable combination.
The list of data structures is traversed pre-order in a depth-first
fashion. That is, the BLOCK is called for the container reference before is
it called for it's elements (although see "recurse" below for post-order).
The values of a hash are traversed in the usual "values" order which may
affect some applications.
If the "cut" subroutine is called in the BLOCK then the traversal stops for
that branch, say if you "cut" an array then the code is never called for
it's elements (or their sub-elements). To simultaneously return values and
cut, simply pass the return list to cut: 'cut('add','to','returned');'
The first parameter to the BLOCK is an object which maintains the state of
the traversal. Methods available on this object are described in State
Object below.
%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
%doc Changes README
%changelog