SPUG: Does tie() do file-locking?

Tim Maher/CONSULTIX tim at consultix-inc.com
Wed Jun 14 11:49:28 CDT 2000


I'm teaching my "Intermediate Perl" class this week, and some questions
about file-locking have arisen.  I could probably find the answers myself by
reading some source code, but I'd rather spend my time helping my students
on their lab assignments instead, so I thought I'd ask if anybody knows
the answers:

	1) Does the -i invocation option lock the files it processes?
	(Seems like it should, but if it does, that's not documented!)

	2) Does tie() do file-locking on its own?  If not, how do
	programmers protect the tied-file from disruptive accesses? 
	(such as that of a daemon program, or 500 "nobody UIDs" accessing
	the same CGI program?)

	3) When does the file tied to a hash get updated? Immediately
	on changes to the hash?  Not until UNIX flushes the buffer
	holding the changes (via the next sync() )? Whenever the
	writer of the *DB*_file module feels like doing it?

	(Seems to me that file-locking should ideally be done on a
	per-record basis by the *DB*_file module itself, but I'm
	not finding any relevant documentation, so please clue me in
	if you know!)

TIA,

*========================================================================*
| 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





More information about the spug-list mailing list