SPUG: Does tie() do file-locking?

Christopher Maujean ChrisM at courtlink.com
Wed Jun 14 14:00:17 CDT 2000


Probably wouldn't take much to subclass the DB_File class and make a
Locking_DB_File tie...

-----Original Message-----
From: Tim Maher/CONSULTIX [mailto:tim at consultix-inc.com]
Sent: Wednesday, June 14, 2000 11:29 AM
To: spug-list at pm.org
Subject: RE: SPUG: Does tie() do file-locking?


>Tim,

>Camel p155 (dbmopen) says something about this. Not a lot, but hope it
>helps.

>Brian

Aha!  p. 155 points me to p. 392-393 for details on DB_File, where
there's an example showing how you can lock the tied-hash's entire file.

The upshot is that all you have to do is toggle whole-file locks before
and after every modification to your tied-hash and you can feel safe
(Unfortunately, doing so completely shatters the illusion that you're
dealing with a hash!)

I was hoping for something more automatic and sophisticated than this. . .
Since the DB_File module knows as well as I do when I'm changing the hash,
why can't I just tell it to do the locking for me?

*========================================================================*
| Dr. Tim Maher, CEO, Consultix       (206) 781-UNIX/8649;  ask for FAX# | 
| Email: tim at consultix-inc.com        Web: http://www.consultix-inc.com  |
| CLASSES; 6/12: Int. Perl  6/15: Pat. Matching  8/14: UNIX  8/21: Shell |
| DAMIAN CONWAY Seminars;  Adv. OO Perl: 7/6,  Parsing with Modules: 7/7 |
*========================================================================*


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address





More information about the spug-list mailing list