|
my $self = shift;
my $fn = $self->[FILENAME];
my $fh = $self->[FILEHANDLE];
if ($fh) {
seek $fh, 0, SEEK_END;
return tell($fh)- $self->[STARTPOS];
} elsif ($fn) {
return (-s $fn) - $self->[STARTPOS];
} else {
return length($self->[BUFFER]);
}
NAMEData::TemporaryBag - Handle long size data using temporary file . SYNOPSIS use Data::TemporaryBag;
$data = Data::TemporaryBag->new;
# add long string
$data->add('ABC' x 1000);
# You can use an overridden operator
$data .= 'DEF' x 1000;
...
$substr = $data->substr(2997, 6); # ABCDEF
DESCRIPTIONData::TemporaryBag module provides a bag object class handling long size data. The short size data are kept on memory. When the data size becomes over $Threshold size, they are saved into a temporary file internally. METHOD
GLOBAL VARIABLES
COPYRIGHTCopyright 2001 Yasuhiro Sasama (ySas), <ysas@nmt.ne.jp> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|