Files
perl-File-Find-Closures/perl-File-Find-Closures.spec
2025-08-12 18:14:04 +02:00

87 lines
3.0 KiB
RPMSpec

#
# spec file for package perl-File-Find-Closures
#
# Copyright (c) 2025 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 File-Find-Closures
Name: perl-File-Find-Closures
Version: 1.118.0
Release: 0
# 1.118 -> normalize -> 1.118.0
%define cpan_version 1.118
License: Artistic-2.0
Summary: Functions you can use with File::Find
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/B/BR/BRIANDFOY/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.64
BuildRequires: perl(File::Spec::Functions) >= 3.33
BuildRequires: perl(Test::More) >= 1
BuildRequires: perl(version) >= 0.86
Requires: perl(File::Spec::Functions) >= 3.33
Provides: perl(File::Find::Closures) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
I wrote this module as an example of both using closures and using
File::Find. Students are always asking me what closures are good for, and
here's some examples. The functions mostly stand alone (i.e. they don't
need the rest of the module), so rather than creating a dependency in your
code, just lift the parts you want).
When I use File::Find, I have two headaches—coming up with the '\&wanted
function' to pass to 'find()', and acculumating the files.
This module provides the '\&wanted' functions as a closures that I can pass
directly to 'find()'. Actually, for each pre-made closure, I provide a
closure to access the list of files too, so I don't have to create a new
array to hold the results.
The filenames are the full path to the file as reported by File::Find.
Unless otherwise noted, the reporter closure returns a list of the
filenames in list context and an anonymous array that is a copy (not a
reference) of the original list. The filenames have been normalized by
'File::Spec::canonfile' unless otherwise noted. The list of files has been
processed by 'File::Spec::no_upwards' so that "." and ".." (or their
equivalents) do not show up in the list.
%prep
%autosetup -n %{cpan_name}-%{cpan_version} -p1
%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 examples SECURITY.md
%license LICENSE
%changelog