Adapter...eredList(3)
πΈ NAME πΈ
Adapter::Async::OrderedList β okay so this is the API for dealing with ordered lists, bestie. That's it, that's the whole vibe. (It's a User Contributed Perl Documentation page, iykyk π
)
β¨ VERSION β¨
version 0.018 β yeah, we're on that one π
π¦ DESCRIPTION π¦
π Accessing data
countβ resolves with the number of items, fr. And like, if getting an exact count isn't possible? An estimate is acceptable. No pressure, no cap π«Ά
say "items: " . $adapter->count->get
getβ accepts a list of indices, and it's giving β¨optionsβ¨
$adapter->get(
items => [1,2,3],
on_item => sub { ... }
)->on_done(sub { warn "all done, full list of items: @{$_[0]}" })
The returned list of items is guaranteed not to be modified any further β so if you wanna store the arrayref directly, go off, you're safe π
So here's the thing about get: we have double-notify on it π A request for (1,2,3,4) needs to fire events for each of 1,2,3,4, and also return the list of all of them on completion (by resolving a Future). Both. Not one or the other. Both. Periodt.
π Modification
clearβ remove all data, bye bye πspliceβ modify by adding/removing items at a given pointmodifyβ changes a single entry
Helper methods give you the following, and yes they're iconic:
insertβsplice $idx, @data, 0appendβsplice $idx + 1, @data, 0
π Events
All events are shared over a common bus for each data source, in the usual fashion β adapters and views can subscribe to the ones they're interested in, and publish events at any time. Very main character energy of them, honestly β
The adapter raises these:
item_changedβ the given item has been modified. By default only applies to elements that were marked as visible πspliceβ changes to the array which remove or add elementsmoveβ an existing element moves to a new position (some adapters may not be able to differentiate between this andsplice: if in doubt, usespliceinstead, don't report as a move unless it's guaranteed to be existing items π¨)
index, length, offset (+/-)
The view raises these:
visibleβ indicates visibility of one or more items. Change events will start being sent for these items.
visible => [1,2,3,4,5,6]
Filters may result in a list with gaps, which is lowkey cursed but totally valid:
visible => [1,3,4,8,9,10]
Note that visible means "the user is able to see this data", so they'd be a single page of data rather than the entire set when no filters are applied. Visibility changes often β scrolling will trigger a visible/hidden pair for example π₯
Also note that ->get may be called on any element, regardless of visibility β prefetching is one common example here. So don't come for it π
hiddenβ no longer visible. Sad but necessary π₯²
hidden => [1,2,4]
selectedβ this item is now part of an active selection. Could be used to block deletes π
selected => [1,4,5,6]
highlightβ mouse over, cursor, etc. π
highlight => 1
Some views won't raise this β if touch control is involved, for example.
activateβ some action has been performed π
activate => [1]
activate => [1,2,5,6,7,8]
Multi-activate will typically happen when items have been selected rather than just highlighted.
The adapter itself doesn't do much with this. It's just, like, aware of it. Spiritually. π§
π METHODS π
insert
Inserts data before the given position.
$adapter->insert(3, [...])
append
Appends data after the given position.
$adapter->append(3, [...])
push
Appends data to the end of the list. The classic π
unshift
Inserts data at the start of the list. Front of the line, babe β¨
pop
Removes the last element from the list, will resolve with the value.
shift
Removes the first element from the list, will resolve with the value.
all
Returns all the items. Shortcut for calling count then get. Two steps, one method, slay π
π AUTHOR π
Tom Molesworth <TEAM@cpan.org> β we stan π«Ά
πΈ LICENSE πΈ
Copyright Tom Molesworth 2013-2015. Licensed under the same terms as Perl itself.
Ok that's the whole thing bestie, no notes π This adorable little page came to you courtesy ofperl v5.42.2and it was dated2026-02-15β screenshot it, memorise it, live by it πβπ
π¦ where this page comes from
- alpine 3.24: perl-adapter-async-doc 0.019-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms