NAME
ArrayData - Specification for ArrayData::*, modules that contains array data
SPECIFICATION VERSION
0.2
VERSION
This document describes version 0.2.3 of ArrayData (from Perl distribution ArrayData), released on 2021-05-18.
SYNOPSIS
Use one of the ArrayData::*
modules.
DESCRIPTION
NOTE: EARLY SPECIFICATION; THINGS WILL STILL CHANGE A LOT.
ArrayData::*
modules are modules that contain array data. The array can be stored in an actual Perl array in the source code, or as lines in the DATA section of the source code, or in other places. The array data can be accessed via a standard interface (see ArrayDataRole::Spec::Basic). Some examples of array data are:
list of country names in English (ArrayData::CountryName::EN)
list of Indonesian words from KBBI dictionary (ArrayData::Word::ID::KBBI)
Also under WordList::ID::KBBI.
list of CPAN authors' PAUSE ID's (ArrayData::CPAN::PAUSEID)
Also under WordList::CPAN::PAUSEID.
Why put data in a Perl module, as a Perl distribution? To leverage the Perl/CPAN toolchain and infrastructure: 1) ease of installation, update, and uninstallation; 2) allowing dependency expression and version comparison; 3) ease of packaging further as OS packages, e.g. Debian packages (converted from Perl distribution); 4) testing by CPAN Testers.
To get started, see ArrayDataRole::Spec::Basic and one of existing ArrayData::*
modules.
NAMESPACE ORGANIZATION
ArrayData
(this module) is the specification.
All the modules under ArrayData::*
should be modules with actual data (base classes should be put in ArrayDataBase::*
, roles in ArrayDataRole::*
).
More specific subnamespaces for more specific types of elements:
ArrayData::String::*
Strings. (But please see other more specific names.)
ArrayData::Word::*
Dictionary word lists (further classified as (further classified in
ArrayData::Word::
LanguageCode::*
e.g. ArrayData::Word::ID::KBBI). These are designed to replace old WordList::* modules.ArrayData::Phrase::*
Phrase lists. Designed to replace old
WordList::Phrase::*
modules.ArrayData::CPAN::*
Arrays related to CPAN. Designed to replace old
WordList::Domain::*
modules.ArrayData::Domain::*
Domain names or suffixes. Designed to replace old
WordList::Domain::*
modules.ArrayData::HTTP::*
HTTP-related array data. Designed to replace old
WordList::HTTP::*
modules.ArrayData::Number::*
Numbers.
ArrayData::Password::*
Passwords. Designed to replace old
WordList::HTTP::*
modules.
ArrayDataBase::*
the base classes. ArrayDataBases::*
are main module names for distributions that bundle multiple base classes.
ArrayDataRole::*
the roles. ArrayDataRoles::*
are main module names for distributions that bundle multiple roles.
ArrayDataBundle::*
are main module names for distributions that contain several ArrayData
modules.
FAQ
Should I use WordList or ArrayData (ArrayData::Word)?
Both are okay. If you prefer WordList then by all means use it. Existing WordList::* modules will stay. WordList's API is now frozen. New development and updates to word lists will happen mostly in ArrayData only.
What are the differences between ArrayData and WordList?
Method names:
Function In WordList In ArrayData
-------- ----------- ------------
iterating words each_word() each_item() (from Role::TinyCommons::Iterator::Resettable)
reset_iterator() + first_word() + next_word() reset_iterator() + has_next_item() + get_next_item() (from Role::TinyCommons::Iterator::Resettable)
checking if a word exists word_exists() has_item() (from Role::TinyCommons::Collection::FindItem)
getting all words all_words() get_all_items() (from Role::TinyCommons::Iterator::Resettable)
picking random words pick() pick_items() (from Role::TinyCommons::Collection::PickItems)
Additional roles:
Function In WordList In ArrayData
-------- ----------- ------------
Binary search WordListRole::BinarySearch ArrayDataRole::BinarySearch::LinesInHandle
Bloom filter WordListRole::Bloom ArrayDataRole::Bloom
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/ArrayData.
SOURCE
Source repository is at https://github.com/perlancar/perl-ArrayData.
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/perlancar/perl-ArrayData/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
HashData, TableData are related projects.
WordList is an older, related project. ArrayData and its sister projects HashData & TableData are a generalization and cleanup of the WordList API.
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2021 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.