| 1 | package ArrayData::Char::Latin1::Digit; | ||
| 2 | |||
| 3 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 4 | 1 | our $DATE = '2021-05-20'; # DATE | |
| 5 | 1 | our $DIST = 'ArrayDataBundle-Char-Latin1'; # DIST | |
| 6 | 1 | our $VERSION = '0.003'; # VERSION | |
| 7 | |||
| 8 | 1 | ▶ | use Role::Tiny::With; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | with 'ArrayDataRole::Source::LinesInDATA'; | |
| 10 | 1 | with 'ArrayDataRole::BinarySearch::LinesInHandle'; # add has_item() that uses binary search, just for testing | |
| 11 | 1 | with 'Role::TinyCommons::Collection::FindItem::Iterator'; # add find_Item() (has_item already added above) | |
| 12 | 1 | with 'Role::TinyCommons::Collection::PickItems::RandomSeekLines'; # add pick_items() that uses binary search, just for testing | |
| 13 | |||
| 14 | # STATS | ||
| 15 | |||
| 16 | 1 | 1; | |
| 17 | # ABSTRACT: Latin1 digits | ||
| 18 | |||
| 19 | =pod | ||
| 20 | |||
| 21 | =encoding UTF-8 | ||
| 22 | |||
| 23 | =head1 NAME | ||
| 24 | |||
| 25 | ArrayData::Char::Latin1::Digit - Latin1 digits | ||
| 26 | |||
| 27 | =head1 VERSION | ||
| 28 | |||
| 29 | This document describes version 0.003 of ArrayData::Char::Latin1::Digit (from Perl distribution ArrayDataBundle-Char-Latin1), released on 2021-05-20. | ||
| 30 | |||
| 31 | =head1 SYNOPSIS | ||
| 32 | |||
| 33 | use ArrayData::Char::Latin1::Digit; | ||
| 34 | |||
| 35 | my $ary = ArrayData::Char::Latin1::Digit->new; | ||
| 36 | |||
| 37 | # Iterate the elements | ||
| 38 | $ary->reset_iterator; | ||
| 39 | while ($ary->has_next_item) { | ||
| 40 | my $element = $ary->get_next_item; | ||
| 41 | ... # do something with the element | ||
| 42 | } | ||
| 43 | |||
| 44 | # Another way to iterate | ||
| 45 | $ary->each_item(sub { my ($item, $obj, $pos) = @_; ... }); # return false in anonsub to exit early | ||
| 46 | |||
| 47 | # Get elements by position (array index) | ||
| 48 | my $element = $ary->get_item_at_pos(0); # get the first element | ||
| 49 | my $element = $ary->get_item_at_pos(90); # get the 91th element, will die if there is no element at that position. | ||
| 50 | |||
| 51 | # Get number of elements in the list | ||
| 52 | my $count = $ary->get_item_count; | ||
| 53 | |||
| 54 | # Get all elements from the list | ||
| 55 | my @all_elements = $ary->get_all_items; | ||
| 56 | |||
| 57 | # Find an item. | ||
| 58 | my @found = $ary->find_item(item => 'foo'); | ||
| 59 | my $has_item = $ary->has_item('foo'); # bool | ||
| 60 | |||
| 61 | # Pick one or several random elements. | ||
| 62 | my $element = $ary->pick_item; | ||
| 63 | my @elements = $ary->pick_items(n=>3); | ||
| 64 | |||
| 65 | =head1 DESCRIPTION | ||
| 66 | |||
| 67 | For testing only. | ||
| 68 | |||
| 69 | =head1 HOMEPAGE | ||
| 70 | |||
| 71 | Please visit the project's homepage at L<https://metacpan.org/release/ArrayDataBundle-Char-Latin1>. | ||
| 72 | |||
| 73 | =head1 SOURCE | ||
| 74 | |||
| 75 | Source repository is at L<https://github.com/perlancar/perl-ArrayDataBundle-Char-Latin1>. | ||
| 76 | |||
| 77 | =head1 BUGS | ||
| 78 | |||
| 79 | Please report any bugs or feature requests on the bugtracker website L<https://github.com/perlancar/perl-ArrayDataBundle-Char-Latin1/issues> | ||
| 80 | |||
| 81 | When submitting a bug or request, please include a test-file or a | ||
| 82 | patch to an existing test-file that illustrates the bug or desired | ||
| 83 | feature. | ||
| 84 | |||
| 85 | =head1 SEE ALSO | ||
| 86 | |||
| 87 | =head1 AUTHOR | ||
| 88 | |||
| 89 | perlancar <perlancar@cpan.org> | ||
| 90 | |||
| 91 | =head1 COPYRIGHT AND LICENSE | ||
| 92 | |||
| 93 | This software is copyright (c) 2021 by perlancar@cpan.org. | ||
| 94 | |||
| 95 | This is free software; you can redistribute it and/or modify it under | ||
| 96 | the same terms as the Perl 5 programming language system itself. | ||
| 97 | |||
| 98 | =cut | ||
| 99 | |||
| 100 | __DATA__ | ||