Files
perl-WordList/perl-WordList.spec

93 lines
3.4 KiB
RPMSpec

#
# spec file for package perl-WordList
#
# Copyright (c) 2020 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/
#
Name: perl-WordList
Version: 0.5.2
Release: 0
%define cpan_name WordList
Summary: Word lists
License: Artistic-1.0 OR GPL-1.0-or-later
Group: Development/Libraries/Perl
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/P/PE/PERLANCAR/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Test::Exception)
BuildRequires: perl(Test::More) >= 0.98
%{perl_requires}
%description
'WordList::*' modules are modules that contain, well, list of words. This
module, 'WordList', serves as a base class and establishes convention for
such modules.
'WordList' is an alternative interface for Games::Word::Wordlist and
'Games::Word::Wordlist::*'. Its main difference is: 'WordList::*' wordlists
are read-only/immutable and the modules are designed to have low startup
overhead. This makes them more suitable for use in CLI scripts which often
only want to pick a word from one or several lists.
Unless you are defining a dynamic wordlist (see below), words (or phrases)
must be put in '__DATA__' section, one per line. Putting the wordlist in
the '__DATA__' section relieves perl from having to parse the list during
the loading of the module. To search for words or picking some random words
from the list, the module also need not slurp the whole list into memory
(and will not do so unless explicitly instructed).
You must sort your words ascibetically (or by Unicode code point). Sorting
makes it more convenient to diff different versions of the module, as well
as performing binary search. If you have a different sort order other than
ascibetical, you must set package variable '$SORT' with some true value
(say, 'frequency').
There must not be any duplicate entry in the word list.
*Dynamic and non-deterministic wordlist.* A dynamic wordlist must set
package variable '$DYNAMIC' to either 1 (deterministic) or 2
(non-deterministic). A dynamic wordlist does not put the wordlist in the
DATA section; instead, user relies on 'each_word()' or 'all_words()' to get
the list. A deterministic wordlist returns the same list everytime
'each_word()' or 'all_words()' is called. A non-deterministic list can
return a different list for a different 'each_word()' or 'all_words()'
call.
%prep
%setup -q -n %{cpan_name}-%{version}
%build
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes README
%license LICENSE
%changelog