NAME

Data::Pointer::IO - The IO pointer type

SYNOPSIS

	use Data::Pointer qw(ptr);
  
	open(my $fh, '<', 'somefile.txt') or die("ack - $!");
	my $ptr = ptr( $fh );

	print scalar $ptr->deref;      		  # first line of file
	print $ptr->deref;                    # all of file
  
	open(my $fh, '>', 'somefile.txt') or die("ack - $!");
	my $ptr = ptr( $fh );

	$ptr->deref = "foo";                  # first line of somefile.txt
	                                      # now equals 'foo'

DESCRIPTION

The IO pointer type works on a per line basis (or whatever $/ is set to). Because most of the magic is done by Tie::File it the dereferencing and assignment should work in a similar way.

METHODS

assign($filehandle)

Assign the pointer to a different value

p = fopen('somefile', 'r')
deref

Dereference the pointer or assign to the value it's pointing to

fgets(ret, SIZE_OF_$/, p)
fputs(val, p)
incr([$num])

Increments the position of the pointer (default is 1)

p++
decr([$num])

Decrements the position of the pointer (default is 1)

p--
plus($num)

Return a pointer by the given offset

p + 1
minus($num)

Return a pointer by the given offset

p - 1

THANKS

Dominus for the all singing, all dancing Tie::File

AUTHOR

Dan Brook <broquaint@hotmail.com>