Files
perl-PERLANCAR-Module-List/perl-PERLANCAR-Module-List.spec
2025-08-12 18:16:26 +02:00

128 lines
3.6 KiB
RPMSpec

#
# spec file for package perl-PERLANCAR-Module-List
#
# 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 PERLANCAR-Module-List
Name: perl-PERLANCAR-Module-List
Version: 0.4.5
Release: 0
%define cpan_version 0.004005
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Fork of Module::List
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/P/PE/PERLANCAR/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(File::Slurper)
BuildRequires: perl(Test::More) >= 0.98
Provides: perl(PERLANCAR::Module::List) = %{version}
%undefine __perllib_provides
Recommends: perl(String::Wildcard::Bash) >= 0.040
%{perl_requires}
%description
This module is my personal experimental fork of Module::List; the
experiment has also produced other forks like Module::List::Tiny,
Module::List::Wildcard. It's like Module::List, except for the following
differences:
* * lower startup overhead (with some caveats)
It avoids using Exporter and implements its own import(). It avoids
IO::Dir, Carp, File::Spec, with the goal of saving a few milliseconds (a
casual test on my PC results in 11ms vs 39ms).
Path separator is hard-coded as '/'.
* * Recognize 'all' option
If set to true and 'return_path' is also set to true, will return all found
paths for each module instead of just the first found one. The values of
result will be an arrayref containing all found paths.
* * Recognize 'wildcard' option
This boolean option can be set to true to recognize wildcard pattern in
prefix. Wildcard patterns such as jokers ('?', '*', '**'), classes
('[a-z]'), as well as braces ('{One,Two}') are supported. '**' implies
recursive listing.
Examples:
list_modules("Module::P*", {wildcard=>1, list_modules=>1});
results in something like:
{
"Module::Patch" => undef,
"Module::Path" => undef,
"Module::Pluggable" => undef,
}
while:
list_modules("Module::P**", {wildcard=>1, list_modules=>1});
results in something like:
{
"Module::Patch" => undef,
"Module::Path" => undef,
"Module::Path::More" => undef,
"Module::Pluggable" => undef,
"Module::Pluggable::Object" => undef,
}
while:
list_modules("Module::**le", {wildcard=>1, list_modules=>1});
results in something like:
{
"Module::Depakable" => undef,
"Module::Install::Admin::Bundle" => undef,
"Module::Install::Admin::Makefile" => undef,
"Module::Install::Bundle" => undef,
"Module::Install::Makefile" => undef,
"Module::Pluggable" => undef,
}
%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
%license LICENSE
%changelog