Files
perl-WordList/perl-WordList.spec

119 lines
4.5 KiB
RPMSpec
Raw Permalink Normal View History

#
# 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
2025-08-12 18:18:28 +02:00
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.
Accepting request 808735 from devel:languages:perl:autoupdate updated to 0.7.5 see /usr/share/doc/packages/perl-WordList/Changes 0.7.5 2020-05-24 Released-By: PERLANCAR; Urgency: medium - No spec changes. - Split new() to WordListBase. - [doc] Add more docs. 0.7.4 2020-05-24 Released-By: PERLANCAR; Urgency: medium - No spec changes. - Improve reusability: abstract filehandle and original position in 'fh' and 'fh_orig_pos' object attribute. 0.7.3 2020-05-23 Released-By: PERLANCAR; Urgency: medium - No spec changes. - Implement each_word() in terms of first_word() and next_word() to reduce code duplication. 0.7.2 2020-05-23 Released-By: PERLANCAR; Urgency: medium - No spec changes. - Add tests. 0.7.1 2020-05-23 Released-By: PERLANCAR; Urgency: medium - No spec changes. - Use value from orig_class attribute to keep working when class/object is mixed with roles into another package. - [doc] WordListRole::WordList: Document the required methods. - [doc] Add FAQ item about pick() returning '1'. - [doc] Remove mention of WordListMod::* modules. 0.7.0 2020-05-22 Released-By: PERLANCAR; Urgency: medium; Backward-Compatible: no - No spec changes. - [incompatible] Change storage of object from inflexible array to flexible hash. 0.6.2 2020-05-22 Released-By: PERLANCAR; Urgency: medium - No spec changes. - pick(): Don't die when allow_duplicates is set to true. 0.6.1 2020-05-22 Released-By: PERLANCAR; Urgency: medium - Specify that user can now instruct pick() to allow duplicates, by setting the second argument to true. OBS-URL: https://build.opensuse.org/request/show/808735 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-WordList?expand=0&rev=8
2020-05-28 22:26:56 +00:00
'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
Accepting request 808735 from devel:languages:perl:autoupdate updated to 0.7.5 see /usr/share/doc/packages/perl-WordList/Changes 0.7.5 2020-05-24 Released-By: PERLANCAR; Urgency: medium - No spec changes. - Split new() to WordListBase. - [doc] Add more docs. 0.7.4 2020-05-24 Released-By: PERLANCAR; Urgency: medium - No spec changes. - Improve reusability: abstract filehandle and original position in 'fh' and 'fh_orig_pos' object attribute. 0.7.3 2020-05-23 Released-By: PERLANCAR; Urgency: medium - No spec changes. - Implement each_word() in terms of first_word() and next_word() to reduce code duplication. 0.7.2 2020-05-23 Released-By: PERLANCAR; Urgency: medium - No spec changes. - Add tests. 0.7.1 2020-05-23 Released-By: PERLANCAR; Urgency: medium - No spec changes. - Use value from orig_class attribute to keep working when class/object is mixed with roles into another package. - [doc] WordListRole::WordList: Document the required methods. - [doc] Add FAQ item about pick() returning '1'. - [doc] Remove mention of WordListMod::* modules. 0.7.0 2020-05-22 Released-By: PERLANCAR; Urgency: medium; Backward-Compatible: no - No spec changes. - [incompatible] Change storage of object from inflexible array to flexible hash. 0.6.2 2020-05-22 Released-By: PERLANCAR; Urgency: medium - No spec changes. - pick(): Don't die when allow_duplicates is set to true. 0.6.1 2020-05-22 Released-By: PERLANCAR; Urgency: medium - Specify that user can now instruct pick() to allow duplicates, by setting the second argument to true. OBS-URL: https://build.opensuse.org/request/show/808735 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-WordList?expand=0&rev=8
2020-05-28 22:26:56 +00:00
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