http://qs321.pair.com?node_id=11135575


in reply to Will these functions for use with Storable properly lock my file?

After a little testing, it seems to work well. Hard to say for sure with these race conditions. I did make a change to the _retrieve sub to lock the semaphore file even if the data file does not exist:

sub _retrieve { my $data_file = 'data/plugin_portfolio'; my $lock = $data_file . '.lck'; open (LOCK, "> $lock") or die "Can't open lock file"; flock(LOCK, LOCK_EX); return 0 if !-f $data_file; retrieve $data_file; }

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks