in reply to Storable - File empties itself?
my $fsize = -s $storeFile; print "filesize: $fsize\n"; die if $fsize == 0;
the above will check on the filesize as the script is running from within the script.
Also store {}, $storeFile will create the file to store that empty hash(ref) but not with zero size. So if you see zero size perhaps it's coming because you are re-initialising your code and re-running the part the file is created? And/or, as hippo suggests, store may mess up if it's called at the same time on the same file from 2 different processes without file-locking. See Re: Preventing multiple instances (References on flock and running one copy of a script at a time) (random link I recall seeing lately) for file locking.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Storable - File empties itself?
by feumw (Sexton) on Apr 13, 2023 at 11:54 UTC |