NAME
Data::Pointer::HASH - The SCALAR pointer type
SYNOPSIS
use Data::Pointer qw(ptr);
my $var = { qw( a list of words ) };
my $ptr = ptr( $var );
print $ptr->plus(1)->deref; # listofwords
print scalar $ptr->plus(1)->deref; # list
$ptr->deref = "foo"; # $var->[0] eq 'foo'
DESCRIPTION
The HASH pointer type exists more for completeness than utility. The pointer will be initialised to the first element from a keys
call on the hash that it points to. Since it uses Tie::IxHash
for accessing the hash the order should stay the same if new elements are added via a $p->deref
assignment
METHODS
- assign($)
-
Assign the pointer to a different value p = val
- deref
-
Dereference the pointer or assign to the value it's pointing to *p *p = val
- incr(;$)
-
Increments the position of the pointer (default is 1) p++
- decr(;$)
-
Decrements the position of the pointer (default is 1) p--
- plus($)
-
Return a pointer by the given offset p + 1
- minus($)
-
Return a pointer by the given offset p - 1
AUTHOR
Dan Brook <broquaint@hotmail.com>