Skip to content
Browse files

save2file should warn, not die

  • Loading branch information...
1 parent c45696b commit 76b261f1d50fe40ec71cdaeb940f05c3f0a40461 @pudge pudge committed May 10, 2005
Showing with 8 additions and 3 deletions.
  1. +8 −3 Slash/Utility/System/System.pm
View
11 Slash/Utility/System/System.pm
@@ -394,9 +394,14 @@ sub save2file {
return if $current eq $new;
}
- open my $fh, '>', $file or die "Can't open > $file: $!";
- print $fh $data;
- close $fh;
+ if (open my $fh, '>', $file) {
+ print $fh $data;
+ close $fh;
+ return 1;
+ } else {
+ warn "Can't open > $file: $!";
+ return 0;
+ }
}

0 comments on commit 76b261f

Please sign in to comment.
Something went wrong with that request. Please try again.