119 lines
4.5 KiB
RPMSpec
119 lines
4.5 KiB
RPMSpec
#
|
|
# spec file for package perl-WordList
|
|
#
|
|
# Copyright (c) 2021 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 WordList
|
|
Name: perl-WordList
|
|
Version: 0.7.11
|
|
Release: 0
|
|
Summary: Specification and base class for WordList::*, modules that contain word list
|
|
License: Artistic-1.0 OR GPL-1.0-or-later
|
|
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
|
|
Source100: README.md
|
|
BuildArch: noarch
|
|
BuildRequires: perl
|
|
BuildRequires: perl-macros
|
|
BuildRequires: perl(Role::Tiny)
|
|
BuildRequires: perl(Role::Tiny::With)
|
|
BuildRequires: perl(Test::Exception)
|
|
BuildRequires: perl(Test::More) >= 0.98
|
|
Requires: perl(Role::Tiny)
|
|
Requires: perl(Role::Tiny::With)
|
|
%{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 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. See "DIFFERENCES WITH
|
|
GAMES::WORD::WORDLIST" for more details.
|
|
|
|
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 'first_word()' + 'next_word()', or
|
|
'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. See
|
|
WordListRole::FirstNextResetFromEach, WordListRole::EachFromFirstNextReset,
|
|
WordListRole::FromArray if you want to write a dynamic wordlist module. It
|
|
is possible for a dynamic list to return unordered or duplicate entries,
|
|
but it is not encouraged.
|
|
|
|
*Parameterized wordlist.* When instantiating a wordlist class instance,
|
|
user can pass a list of key-value pairs as parameters. Normally only a
|
|
dynamic wordlist would accept parameters. Parameters are defined in the
|
|
'%PARAMS' package variable. It is a hash of parameter names as keys and
|
|
parameter specification as values. Parameter specification follows function
|
|
argument metadata specified in Rinci::function.
|
|
|
|
*Examples.* Examples can be specified in '@EXAMPLES' package variable. The
|
|
structure is similar to Rinci function's 'examples' property. For example:
|
|
|
|
# in lib/WordList/Test/Dynamic/RandomWord/1000.pm
|
|
|
|
@EXAMPLES = (
|
|
{
|
|
summary => '1000 random words, each 10 to 15 characters long',
|
|
args => {min_len=>10, max_len=>15},
|
|
}
|
|
);
|
|
|
|
%prep
|
|
%autosetup -n %{cpan_name}-%{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
|