For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > December 2007 > Tie::YAML doesn't write to tmp file first?









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 Tie::YAML doesn't write to tmp file first?
Robert Nicholson

2007-12-23, 7:00 pm

So the save method looks like this

sub save{
my $self = shift;
my $filename = $self->filename;
open my $fh, ">:raw", $filename or croak "$filename: $!";
print $fh Dump(damn_scalar($self));
close $fh;
return 1;
}


That means that if it's interrupted during save you've lost your
original file.

Instead of doing that it should be writing to a temporary file first
and then renaming
it later.

Sponsored Links







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

Copyright 2008 codecomments.com