NAME
MemHandle - supply memory-based FILEHANDLE methods
SYNOPSIS
use MemHandle;
use IO::Seekable;
my $mh = new MemHandle;
print $mh "foo\n";
$mh->print( "bar\n" );
printf $mh "This is a number: %d\n", 10;
$mh->printf( "a string: \"%s\"\n", "all strings come to those who wait" );
my $len = $mh->tell(); # Use $mh->tell();
# tell( $mh ) will NOT work!
$mh->seek(0, SEEK_SET); # Use $mh->seek($where, $whence)
# seek($mh, $where, $whence)
# will NOT work!
Here's the real meat:
my $mh = new MemHandle;
my $old = select( $mh );
.
.
.
print "foo bar\n";
print "baz\n";
&MyPrintSub();
select( $old );
$mh->seek( 0, SEEK_SET );
print "here it all is: ", <$mh>, "\n";
DESCRIPTION
Generates an IO::Handle for use with file routines, but which uses memory.
AUTHOR
"Sheridan C. Rawlins" <scr14@cornell.edu>
SEE ALSO
perl(1). perlfunc(1). perldoc IO::Handle. perldoc IO::Seekable.