TPU ChatChat on IRC
Internet Relay Chat?
Java Applet client
Who's on IRC?
Perl CGI Script: Output file overwritten.
Posted by eXorcus [send private reply] at August 09, 2002, 11:46:13 AM Hey all, I have a news posting script on my site set up and all it does is takes the contents of a text area form object and writes it to the news.pst file. It was all working fine and dandy, but my friend and I posted (perhaps at the same time) and after going back to the view news page (news.pl) I found that all other posts except my own and my friends were gone.
I don't have any file locking on the script, and was thinking that that could be how the rest of the posts were deleted. Any ideas?
Posted by Psion [send private reply] at August 09, 2002, 12:53:07 PM You haven't really given enough information here to diagnose anything, but I think your problem is a good example of why using "database" software keeps you from having to worry about issues like this.
Posted by eXorcus [send private reply] at August 09, 2002, 01:08:47 PM Yeah, I'm stuck using flat databases in ASCII text files 'cause my webhosting account is a free account and doesn't come with any database software. By database software, are you referring to software like mSQL and such?
Posted by Psion [send private reply] at August 09, 2002, 04:07:41 PM Anything that calls itself a "database management system" will probably avoid the problem you mentioned.
Posted by gian [send private reply] at August 10, 2002, 02:14:10 AM eXorcus: Are you appending the text as opposed to just overwriting it?
Posted by unknown_lamer [send private reply] at August 10, 2002, 08:27:18 PM Why not just the berekely db? Most POSIX systems have support for it as part of the libc and it is based on small binary files. It isn't as featureful as a full blown SQL database, but is is fast and doesn't require any extra programs. I think that perl has support for it in the set of standard packages. And it uses regular files so no worries about the ISP not running any software.
Posted by eXorcus [send private reply] at August 13, 2002, 07:07:13 AM Nice, I'll check that out then. Working with the plain text is difficult at best.
gian: I think the problem may be reading the file, because I have it read the file, then open it for output and write the post and then write the read data (old posts). This is so that new posts appear at the top. I'll double check my permissions on the post file, but if it isn't that I have no idea.
Register as a new user