X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/c618f5d8c66b51ec021df5aea7caa49f50d00772..73f2498331782691215bb4cc02fc4431145b7027:/modules/File/Access.pm diff --git a/modules/File/Access.pm b/modules/File/Access.pm index 3bfd50d..6ab193e 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: 2004-08-05 +# Last modified: 2004-10-26 # use strict; @@ -20,32 +20,12 @@ use Fcntl; use base qw(Exporter); -@EXPORT = qw(chgrp - dir_read +@EXPORT = qw(dir_read file_create file_read file_save file_unlock); -# chgrp() -# -# Change the group of files or directories -# -# Params: 1. Group name -# 2. List of files -# -# Return: Number of files group successfully changed -# (or false) - -sub chgrp($@) -{ - my ($group,@files) = @_; - my $gid = ($group !~ /^\d+$/) ? getgrnam($group) : $group; - - return unless($gid); - return chown(-1,$gid,@files); -} - # dir_read() # # Collect the files and directories in a directory @@ -94,7 +74,11 @@ sub dir_read($) # file_create() # -# Create a file +# Create a file, but only if it doesn't already exist +# +# (I wanted to use O_EXCL for this, but `perldoc -f sysopen` +# doesn't say that it is available on every system - so I +# created this workaround using O_RDONLY and O_CREAT) # # Params: File to create #