Kent Fredric πŸ”₯🐢🍡πŸ”₯
and 1 contributors


Data::Couplet::Private - Private internal bits for Data::Couplet


version 0.02004314


This class contains all the private stuff Data::Couplet uses.

This arrangement is somewhat experimental, but its benefits are as follows

- Publicly Readable Private Documentation

Ensures that other people hacking on internals have plenty to work with

- Private Documentation Separate from Public

Ensures end users don't get weighed down and tempted by stuff they don't need.

- Separation of Concerns

Separates logically the interface from the implementation, allowing for more disperse changes without worry about breaking things.

The above structure could also be reverted back to something more sane, but you shouldn't mind, you don't rely on private methods anyway, do you? :)


These might change yet from a hash quad to something simpler, like

    [  k, k, k, ]
    { k => [ i, k, v ], k => [ i, k, v ] }

_ko : rw HashRef

Stores a mapping of Keys to Objects.


This is our internal way of mapping scalar representations of objects back to the objects. NB: Because of how the conversion to scalar works at present, if an object is used for a key that has string overload, the overloaded value will be used in the index.

_kv : rw HashRef

Stores a mapping of Keys to Values


This is our primary data store, unordered, this is the part of the data that directly represents what you would get with a normal hash.

_ki : rw HashRef

Stored a mapping of Keys to Indexes.


This is required if you need to know where in an array a key is without having to search the array for it. It also makes data set reordering much easier, increment values :)

_ik : rw ArrayRef

This keeps our keys in order



->_object_to_key ( $object ) : String

 Maps Anything to a usable Key.
 Essentially, stringify.
 This is done this way in case we need to change it later

->_unset_at ( Int $index ) : $self : Modifier

 Deletes things that are found using an index only.

->_unset_key ( String $key ) : $self : Modifier

 Deletes things that are found using a key only

->_move_key_range( Int $left , Int $right , Int $jump ) : $self : Modifier

 Move a set of keys in the hash
 by $amt in $sign direction
 ->_move_key_range( $start, $stop , -1 ); # move left
 ->_move_key_range( $start, $stop , +1 ); # move right

->_index_key ( String $key ) : Int : Modifier

Given a key, asserts it is in the data set, either by finding it or by creating it. Returns where the key is.

->_set ( Any $object , Any $value ) : $self : Modifier

Insertion is easy. Everything that inserts the easy way can call this.

->_set_kiov ( String $key , Int $index, Any $object , Any $value ) : $self : Modifier

Handles the part of assigning all the Key => Value association needed in many parts.

->_sync_ki : $self : Modifier

Assume _ki is dead, and _ik is in charge, rebuild _ki from _ik

->_sync_ik : $self : Modifier

Assume _ik is dead, and _ki is in charge, rebuild _ik from _ki


Kent Fredric <kentnl at>


This software is copyright (c) 2011 by Kent Fredric.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.