Adapter...eredMap(3)
π NAME π
okay so this is Adapter...eredMap(3) from the User Contributed Perl Documentation, and the actual module is Adapter::Async::UnorderedMap β literally the API for dealing with key => value maps. map girlie behavior, no cap. πΊοΈβ¨
πΈ VERSION πΈ
version 0.018 β that's the version, bestie. π
π¦ DESCRIPTION π¦
π Accessing data
countβ resolves with the number of items. If this isn't possible, an estimate may be acceptable. lowkey flexible. π«
say "items: " . $adapter->count->get
getβ accepts a list of keys. π
$adapter->get(
items => [1,2,3],
on_item => sub { ... }
)->on_done(sub { warn "all done, full list of items: %{$_[0]}" })
Unlike the get in Adapter::Async::OrderedList method, this resolves to a hashref. plot twist! π«Ά
The top-level of the hashref returned is guaranteed not to be modified further, if you want to store it directly. No such guarantee applies to the values themselves β it is only a shallow clone. so like, shallow clone only, bestie. πΈ
This means we have double-notify on get: a request for (a,b, 34, q) needs to fire events for each of a,b,34,q, and also return the hashref containing those keys on completion (by resolving a Future). πβ¨
π οΈ Modification
clearβ remove all datamodifyβ changes a single entrysetβ adds a new keydeleteβ removes an existing key
π£ 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. group chat for data, basically. π¬π¦
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 key (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)
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:
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. prefetch era, honestly. π§
hiddenβ no longer visible. π
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. like, it's just vibing. π
π METHODS π
β¨ set
Sets the value of a key.
$adapter->set(xyz => 'abc')
β¨ all
Returns all the items. Shortcut for calling count then get. π
π AUTHOR π
Tom Molesworth <TEAM@cpan.org>
π LICENSE π
Copyright Tom Molesworth 2013-2015. Licensed under the same terms as Perl itself.
okay that's the whole page, bestie. the footer energy is perl v5.42.2, dated 2026-02-15 β mwah πβ¨
π¦ 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