NAME

ArrayData - Specification for ArrayData::*, modules that contains array data

SPECIFICATION VERSION

0.2

VERSION

This document describes version 0.2.4 of ArrayData (from Perl distribution ArrayData), released on 2021-09-26.

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:

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

ArrayData (this module) is the specification.

All the modules under ArrayData::* should be modules with actual data.

More specific subnamespaces for more specific topics and/or types of elements:

  • ArrayData::Lingua::*

    See also: TableData::Lingua::*.

  • ArrayData::Lingua::Word::*

    Dictionary word lists (further classified as (further classified in ArrayData::Lingua::Word::LanguageCode::* e.g. ArrayData::Lingua::Word::ID::KBBI). These are designed to replace old WordList::* modules.

    See also: TableData::Lingua::Word::*.

  • ArrayData::Lingua::Phrase::*

    Phrase lists. Designed to replace old WordList::Phrase::* modules.

    See also: TableData::Lingua::Phrase::*.

  • ArrayData::CPAN::*

    Arrays related to CPAN. Designed to replace old WordList::CPAN::* modules.

    See also: TableData::CPAN::*.

  • 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::Password::* modules.

ArrayDataBundle

ArrayDataBundle::* are main module names for distributions that contain several ArrayData modules.

ArrayDataBase

ArrayDataBase::* are the base classes. ArrayDataBases::* are main module names for distributions that bundle multiple base classes. Since ArrayData is largely role-based, it is expected that we do not have many of these base classes.

ArrayDataBases

ArrayDataBases::* are main module names for distributions that bundle multiple base classes.

ArrayDataRole

ArrayDataRole::* are the roles.

ArrayDataRoles

ArrayDataRoles::* are main module names for distributions that bundle multiple roles.

ArrayDataUtil

ArrayDataRole::* are for other utility modules related to ArrayData.

ArrayDataUtils

ArrayDataUtils::* are main module names for distributions that bundle multiple ArrayDataUtil::* 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.

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>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

% prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by perlancar <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.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=ArrayData

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.