Corrupted Data
Jimstone77_at_aol.com
Date: 10/30/03
- Next message: Roy Johnson: "Re: What is my name"
- Previous message: Wiggins D Anconia: "Re: config file: a) what Module ? b) conditionals in config (for multiple hosts)"
- Next in thread: Peter Scott: "Re: Corrupted Data"
- Reply: Peter Scott: "Re: Corrupted Data"
- Maybe reply: Jimstone77_at_aol.com: "Re: Corrupted Data"
- Reply: Kevin Pfeiffer: "Re: Corrupted Data"
- Reply: Tore Aursand: "Re: Corrupted Data"
- Maybe reply: Jimstone77_at_aol.com: "Re: Corrupted Data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Oct 2003 09:45:58 EST To: beginners@perl.org
I'm having problems with corrupted data about every month or so. The problem
seems to be that the New file sometimes writes only about half the old file.
I was under the impression that flock would prevent the data from being
corrupted. Can anyone tel me what I am doing wrong, and what I should be doing
instead?
open(OLD,">$old") or die "Can't Open File: $!";
flock OLD, 2;
open(NEW,$new) or die "Can't Open File: $!";
flock NEW, 2;
while (<OLD>) {
if ($_ =~ /NO_EMAIL/) {
$count++;
}
else {
print NEW $_;
}
}
close(NEW) or die "Can't Close File: $!";
close(OLD) or die "Can't Close Old: $!";
Is there something inherently wrong with doing it this way?
- Next message: Roy Johnson: "Re: What is my name"
- Previous message: Wiggins D Anconia: "Re: config file: a) what Module ? b) conditionals in config (for multiple hosts)"
- Next in thread: Peter Scott: "Re: Corrupted Data"
- Reply: Peter Scott: "Re: Corrupted Data"
- Maybe reply: Jimstone77_at_aol.com: "Re: Corrupted Data"
- Reply: Kevin Pfeiffer: "Re: Corrupted Data"
- Reply: Tore Aursand: "Re: Corrupted Data"
- Maybe reply: Jimstone77_at_aol.com: "Re: Corrupted Data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]