NAME

Data::Pointer - Implementation of the concept of C pointers for perl data types

SYNOPSIS

use Data::Pointer qw(ptr);

my $var = [ qw( a list of words ) ];
my $ptr = ptr( $var );

print $ptr->plus(1)->deref;

$ptr->deref = "foo";

DESCRIPTION

Have you ever used pointers in C? Well then using this module should be pretty straight-forward. It implements the basic set of pointer operations which I thought to be useful. Currently 4 of the basic perl data types are implemented (which are SCALAR, ARRAY, HASH and IO[1]) and should behave in an intuitive manner which is also documented in their respective docs.

[1] IO is really a GLOB at this point, although eventually I'd like to implement GLOB pointers, but I may have to smoke a lot of crack that happens

METHODS

new(%)

The class constructor method (see. mutant for the object constructor method) It takes arguments in the form of key value pairs and takes the following parameters

value => What the pointer will be pointing, doesn't have to be a reference
type  => The type of pointer e.g CHAR
size  => Amount of memory to allocate (NOTE: not currently used)
fatal => If set, the program will die if a pointer goes out of bounds
mutant(%)

Will mutate the object according to the given parameters

EXPORT

ptr($;@)

A wrapper around new(). Just provide it with a value and it'll return the correct pointer object.

AUTHOR

Dan Brook <broquaint@hotmail.com>

SEE ALSO

K&R, Tie::File