assuming 2 Mbox objects are created to the same mbox file,
Are locks clever enough to avoid the 2nd open being blocked ?
(my test indicates that 2nd connect succeeds)
if so, how does it deal with modifications performed on 2 handles ?
(i havent tried this).
attached prg tries it 2 different ways, with these results:
(btw, Ive got log, trace options to DEBUG, expected more output)..
1. SEPARATE LEXICAL SCOPES, OPENING MBOX SEQUENTIALLY
[jimc@harpo mb-day1]$ perl should-this-self-dos-Q
Name "DB::single" used only once: possible typo at
should-this-self-dos-Q line 39.
will generate errors opening non-existent mbox
rm mbox.test
PROGRESS: File ./mbox.test for folder ./mbox.test does not exist.
Mail::Box::Mbox->new failed at should-this-self-dos-Q line 58.
touch mbox.test
PROGRESS: Opened folder ./mbox.test to be parsed
NOTICE: Close parser for file ./mbox.test
NOTICE: Close parser for file ./mbox.test
does this dos ?
PROGRESS: Opened folder ./mbox.test to be parsed
NOTICE: Close parser for file ./mbox.test
NOTICE: Close parser for file ./mbox.test
done
Above appears to reclaim locks properly,
tho I dunno why NOTICE comes 2x.
2. DESTROY SUPPRESSED BY COPY B4 OO-SCOPE
displays different DESTROY behavior, but 2nd cant clear lock, as its
pre-cleared
[jimc@harpo mb-day1]$ perl should-this-self-dos-Q TRUE
Name "DB::single" used only once: possible typo at
should-this-self-dos-Q line 39.
prevent lexical oo-scope cleanups
will generate errors opening non-existent mbox
rm mbox.test
PROGRESS: File ./mbox.test for folder ./mbox.test does not exist.
Mail::Box::Mbox->new failed at should-this-self-dos-Q line 58.
touch mbox.test
PROGRESS: Opened folder ./mbox.test to be parsed
does this dos ?
ouch, found './mbox.test.lock', deleting at should-this-self-dos-Q line 48.
PROGRESS: Opened folder ./mbox.test to be parsed
done
NOTICE: Close parser for file ./mbox.test
NOTICE: Close parser for file ./mbox.test
NOTICE: Close parser for file ./mbox.test
NOTICE: Close parser for file ./mbox.test
Couldn't remove lockfile ./mbox.test.lock: No such file or directory
Looks like 2nd object Destroy failed to unlock, cuz 1st did previously.
FOLLOWON QS
It would be nice to have access => 'rwc', with c == create,
which would do the `touch $file` equivalent, in a robust portable way.
at outset, it seemed to me that 1 or 2 should DOS the mbox file - at
least for 2nd
attempt. Ill try a open1,2 change1, read2.
|