diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | lib/MDK/Common/File.pm | 2 |
2 files changed, 4 insertions, 1 deletions
@@ -1,3 +1,6 @@ +- append_to_file: better error message making easier to pinpoint actual place + of error + Version 1.2.26 - 20 July 2010, by Thierry Vignaud - if_, if__: make easier to debug (#60153) diff --git a/lib/MDK/Common/File.pm b/lib/MDK/Common/File.pm index 1d5dc21..48fd702 100644 --- a/lib/MDK/Common/File.pm +++ b/lib/MDK/Common/File.pm @@ -151,7 +151,7 @@ sub cat_utf8_or_die { open(my $F, '<:utf8', $_[0]) or die "can't read file $_[0] sub cat__ { my ($f) = @_; my @l = <$f>; wantarray() ? @l : join '', @l } sub output { my $f = shift; open(my $F, ">$f") or die "output in file $f failed: $!\n"; print $F $_ foreach @_; fsync($F); 1 } sub output_utf8 { my $f = shift; open(my $F, '>:utf8', $f) or die "output in file $f failed: $!\n"; print $F $_ foreach @_; fsync($F); 1 } -sub append_to_file { my $f = shift; open(my $F, ">>$f") or die "output in file $f failed: $!\n"; print $F $_ foreach @_; fsync($F); 1 } +sub append_to_file { my $f = shift; open(my $F, ">>$f") or die "append to file $f failed: $!\n"; print $F $_ foreach @_; fsync($F); 1 } sub output_p { my $f = shift; mkdir_p(dirname($f)); output($f, @_) } sub output_with_perm { my ($f, $perm, @l) = @_; mkdir_p(dirname($f)); output($f, @l); chmod $perm, $f } sub linkf { unlink $_[1]; link $_[0], $_[1] } |