diff options
author | Thierry Vignaud <tv@mandriva.org> | 2010-10-24 01:51:21 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2010-10-24 01:51:21 +0000 |
commit | 46efc8335881b630ae63dc4483500ddce026b434 (patch) | |
tree | 32511e61a26b43b3b8f7a2cbf1bea49eea545e01 /lib/MDK | |
parent | 54e72c13bfedc27a9d53102d7d7949646ae94927 (diff) | |
download | perl-MDK-Common-46efc8335881b630ae63dc4483500ddce026b434.tar perl-MDK-Common-46efc8335881b630ae63dc4483500ddce026b434.tar.gz perl-MDK-Common-46efc8335881b630ae63dc4483500ddce026b434.tar.bz2 perl-MDK-Common-46efc8335881b630ae63dc4483500ddce026b434.tar.xz perl-MDK-Common-46efc8335881b630ae63dc4483500ddce026b434.zip |
append_to_file: better error message making easier to pinpoint actual place of error
Diffstat (limited to 'lib/MDK')
-rw-r--r-- | lib/MDK/Common/File.pm | 2 |
1 files changed, 1 insertions, 1 deletions
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] } |