X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/3e6b9e338fe5ea06b487202fe54217f2082cd13d..d5e736038704bf5dad49f06541658930d6fc3deb:/modules/File/Access.pm?ds=sidebyside diff --git a/modules/File/Access.pm b/modules/File/Access.pm index 81b6851..da783d3 100644 --- a/modules/File/Access.pm +++ b/modules/File/Access.pm @@ -7,7 +7,7 @@ package File::Access; # with only one command # # Author: Patrick Canterino -# Last modified: 09-20-2003 +# Last modified: 09-26-2003 # use strict; @@ -107,9 +107,9 @@ sub file_read($) my $file = shift; local *FILE; - open(FILE,"<",$file); + open(FILE,"<",$file) or return; read(FILE, my $content, -s $file); - close(FILE); + close(FILE) or return; return \$content; } @@ -121,7 +121,7 @@ sub file_read($) # Params: 1. File # 2. File content as Scalar Reference # -# Return: Status Code (Boolean) +# Return: Status code (Boolean) sub file_save($$) { @@ -130,10 +130,10 @@ sub file_save($$) local *FILE; open(FILE,">",$temp) or return; - print FILE $$content; - close(FILE) or return; + print FILE $$content or do { close(FILE); return }; + close(FILE) or return; - rename($temp,$file) or return; + rename($temp,$file) or return; return 1; }