in reply to Autoflush/Buffer Problem

iSinaWhat might be the reason for this behaviour

from your code posted as Anonymous (Re^2: Autoflush/Buffer Problem), I can see that you
use Tie::File on an already opened file:
... my $input = $mw->getOpenFile(); open FILE, ">$input" or die $!; FILE->autoflush(1); ... tie @lines, 'Tie::File', $input or die $!; ...
This is, according to the Tie::File documetation,
not supported. You have to provide the filehandle:
... open FILE, ">$input" or die $!; tie @array, 'Tie::File', \*FILE, ...; ...
From your code fragment posted it can be seen
that there are at least one zillion interactions
with other (unposted) code parts that may contain bugs ;-)

So one can only wish that the "force may be you" in
cleaning up this program eventually ...

Regards

mwa

Replies are listed 'Best First'.
Re^2: Autoflush/Buffer Problem
by iSina (Acolyte) on Oct 08, 2007 at 01:13 UTC
    Yes I do have lots of other functions but they are rather discrete. So most of the part I have to individually fix them if something goes wrong. Thanks though :/ And as far as what you said, I didnt know of such a thing so I tried to close the file before using tie but it seemed to produce no effect. Still the last remaining of my data is kept in buffer until I close the program... And for the other part, I tried using \* without closing the file before hand but this time the tie didnt work and the array wasnt created. Strange :/ I will read more on the link you have given, thanks.