For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > April 2007 > File Access + Thread Safe









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author File Access + Thread Safe
Yitzle

2007-04-22, 3:58 am

I got a CGI script that is being used by multiple users.
It reads/writes data to a database (text file).
When it reads, it reads the entire file, and when it writes, it
tuncrates and rewrites the entire file.
Can/will this screw up the file if two people try to write to the file
at the same time?
How do I prevent problems? (SQL/MySQL is not an option)
Paul

2007-04-22, 3:58 am

On Sun, April 22, 2007 12:52 am, yitzle wrote:
> I got a CGI script that is being used by multiple users.
> It reads/writes data to a database (text file).
> When it reads, it reads the entire file, and when it writes, it
> tuncrates and rewrites the entire file.
> Can/will this screw up the file if two people try to write to the file
> at the same time?
> How do I prevent problems? (SQL/MySQL is not an option)


I don't think it would because the first person to open the file has the
editing rights. Another person that would open the file after the first
one would think they are editing but it would not save.

John W. Krahn

2007-04-22, 3:58 am

yitzle wrote:
> I got a CGI script that is being used by multiple users.
> It reads/writes data to a database (text file).
> When it reads, it reads the entire file, and when it writes, it
> tuncrates and rewrites the entire file.
> Can/will this screw up the file if two people try to write to the file
> at the same time?
> How do I prevent problems? (SQL/MySQL is not an option)


perldoc -q "\block"



John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
Abstertard17

2007-04-25, 3:36 am

Natalie Portman in anal action!
http://Natalie-Portman-anal-action....hp?movie=726071
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com